Skip to content

Conversation

@wayfarer3130
Copy link
Contributor

The retrieveInstanceFrames works, but doesn't return the transfer syntax, making the image undecodeable in general. This PR just adds that as a hidden attribute on the buffer object being returned.

@wayfarer3130 wayfarer3130 requested a review from pieper June 16, 2025 21:47
@wayfarer3130
Copy link
Contributor Author

@pieper - I will get the first PR done first, then merge it here and finish with this one.


requestInstance.open(method, url, true);
if ('responseType' in request) {
if (request.responseType) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excludes null/undefined which was causing issues.

'image/gif',
'image/png',
'image/jp2',
'image/*',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image/* is a valid type, and I was trying to get the generic retrieve working, but it doesn't seem to be allowed for dcm4chee

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some fixes for the retrieveInstanceFrames, needed since I added an actual integration test for it, and that wasn't running until I added the fixes.

* @param {*} destination
* @param {string} headerString
*/
function addHeaders(destination, headerString) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows for retrieving the actual transfer syntax used in the image encoding. This is allowed by Part 18, but unfortunately not required there.

}

Object.defineProperty(destination, 'headers', { value: headers });
Object.defineProperty(destination, 'contentType', { value: contentType });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having at least the contentType allows one to figure out what the encoding is close enough to allow testing for which decoder to use.

// mediaTypes: [ {mediaType: 'image/*' }],
};

const frames = dwc.retrieveInstance(options);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't even use the await, so it was essentially an empty test, without checking if the response was valid.

const frames = dwc.retrieveInstance(options);
});
const frames = await dwc.retrieveInstanceFrames(options);
expect(frames instanceof Array).toBe(true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the test at least checks that the response has an image frame, and for the given server, tests for uncompressed.

};

const metadata = await dwc.retrieveInstanceMetadata(options);
const metadata = await dwc.retrieveSeriesMetadata(options);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since instance metadata is tested elsewhere, this tests just makes sure series metadata also works.

@wayfarer3130
Copy link
Contributor Author

@pieper - I had to make a few more extensive changes for fixing the retrieveInstanceFrames as there were a number of spots that weren't being tested and weren't in fact working. However, I think it is ready for review now.

I'm not sure why the server isn't returning compressed image frames - it should as far as I can tell, but it might be that the content type isn't getting specified in a way that it understands.

Copy link
Contributor

@pieper pieper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I think this makes good sense. Thanks for working on it 👍

@pieper pieper merged commit 5cea7d1 into master Jun 17, 2025
4 checks passed
@pieper pieper deleted the fix/instance-tsuid branch June 17, 2025 22:18
@github-actions
Copy link

🎉 This PR is included in version 0.11.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants