Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pixeldata] Apply VOI LUT when rendering images #599

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abustany
Copy link
Contributor

Fixes: #232

Tested on couple of images locally, this seems to do the job.

There are couple of items I'd like to address before considering this one ready:

  • add couple of unit tests
  • get your feedback @Enet4 on whether the data structures like VoiLut are in the right place...
  • maybe fix the naming, somehow "VOI LUT" can refer to lot of similar but different things 😬 This seems to be an issue with the standard already, but any feedback on how to make names clearer is welcome
  • do we want to make the API public already? Else we could gate the new structs behind pub(crate) for now

@abustany
Copy link
Contributor Author

woops didn't realize I had broken the gdcm feature, will fix

@feliwir
Copy link
Contributor

feliwir commented Nov 11, 2024

I think this will conflict with #598 i just created earlier today

@Enet4 Enet4 added enhancement A-lib Area: library C-pixeldata Crate: dicom-pixeldata labels Nov 11, 2024
@Enet4
Copy link
Owner

Enet4 commented Nov 11, 2024

This does look substantial, thank you for working on this!

  • add couple of unit tests

That would be greatly appreciated. I wonder if some of the DICOM test files available feature VOI LUT sequences. I also happen to have a test enhanced CT scan which I think features a VOI LUT sequence, but I need to check.

  • get your feedback @Enet4 on whether the data structures like VoiLut are in the right place...
    maybe fix the naming, somehow "VOI LUT" can refer to lot of similar but different things 😬 This seems to be an issue with the standard already, but any feedback on how to make names clearer is welcome

From the quick glance I found nothing egregiously wrong, but I will make a better review when I am able.

  • do we want to make the API public already? Else we could gate the new structs behind pub(crate) for now

In this case there is already some value in the library picking up VOI LUT sequences when the object uses that instead of window levels, so we can start with crate-level visibility and expose it later.

@Enet4
Copy link
Owner

Enet4 commented Nov 11, 2024

I think this will conflict with #598 i just created earlier today

If it helps create some coordination, we can decide an order of contribution merges so that we know which one should be rebased.

@abustany
Copy link
Contributor Author

I think this will conflict with #598 i just created earlier today

yup, very likely :-D but I'm happy for you to merge first, I checked your PR and the conflict resolving shouldn't be too hard to do.

Copy link
Owner

@Enet4 Enet4 left a comment

Choose a reason for hiding this comment

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

Thank you again for working on this. I will only leave a few comments inline. Overall this seems to be heading in the right direction. Please let me know when the pull request is ready for a more thorough test.

///
/// See [section C.8.11.3.1.5][1] of the standard for more details.
///
/// [1]: https://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.8.html#sect_C.8.11.3.1.5
Copy link
Owner

Choose a reason for hiding this comment

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

That's a pretty old version of the standard. Search engines are often guilty of not providing pages to the latest versions.

Suggested change
/// [1]: https://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.8.html#sect_C.8.11.3.1.5
/// [1]: https://dicom.nema.org/medical/dicom/2024d/output/chtml/part03/sect_C.8.11.3.html#sect_C.8.11.3.1.5

@@ -642,6 +658,36 @@ impl DecodedPixelData<'_> {
}
}

pub fn voi_lut_sequence(&self) -> Result<Option<&[VoiLut]>> {
Copy link
Owner

Choose a reason for hiding this comment

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

Consider adding a simple doc-comment to this public method.

@abustany
Copy link
Contributor Author

abustany commented Dec 7, 2024

Thanks for the comments! I'll try to take a look next week. I unfortunately haven't found the time yet to finalize the tests - but that's still on my todo 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lib Area: library C-pixeldata Crate: dicom-pixeldata enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VOI LUT Sequence support
3 participants