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

Evaluate windowing from dataset when bitsstored = 1 (#1432) #1751

Merged
merged 3 commits into from
May 18, 2024

Conversation

gofal
Copy link
Contributor

@gofal gofal commented Mar 10, 2024

Fixes #1432

Checklist

  • The pull request branch is in sync with latest commit on the fo-dicom/development branch
  • I have updated API documentation
  • I have included unit tests
  • I have updated the change log
  • I am listed in the CONTRIBUTORS file

Changes proposed in this pull request:

  • when bitsstored is 1 and no windowing data is stored, then fo-dicom evaluates the windowing-parameters based on min/max pixel values. Min is 0 and Max is 1, so windowcenter is 0.5 and windowwidth is 1. But with that formula, everything is evaluted to white.
  • In case bitsstored is 1, then the pixeldata has not to be evaluted, the min and max are always 0 and 1. With the values of windowcenter 1 and windowwith 1 the images are rendered correctly

Copy link

codecov bot commented Mar 10, 2024

Codecov Report

Attention: Patch coverage is 63.63636% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 76.41%. Comparing base (b45ffe1) to head (ca249f8).
Report is 10 commits behind head on development.

❗ Current head ca249f8 differs from pull request most recent head 632032d. Consider uploading reports for the commit 632032d to get more accurate results

Files Patch % Lines
FO-DICOM.Core/Imaging/GrayscaleRenderOptions.cs 63.63% 5 Missing and 3 partials ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           development    #1751      +/-   ##
===============================================
- Coverage        76.42%   76.41%   -0.02%     
===============================================
  Files              275      275              
  Lines            25410    25405       -5     
  Branches          3043     3044       +1     
===============================================
- Hits             19419    19412       -7     
- Misses            5062     5064       +2     
  Partials           929      929              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@amoerie
Copy link
Collaborator

amoerie commented Mar 28, 2024

Any chance we can add the sample DICOM file to the test data and add a unit test that demonstrates the GrayScaleRenderOptions.FromDataset returns the correct result?

@gofal
Copy link
Contributor Author

gofal commented Mar 31, 2024

I will try to find another sample image that is better suited. This 7MB file has a lot of frames and only from frame 100 above there is any pixel data other than black. If I do not find another sample, then I will add the file provided in the issue.

@amoerie
Copy link
Collaborator

amoerie commented Mar 31, 2024

If it's too much trouble, don't worry about it. I was just thinking this would be an easy test to add, to ensure we don't break this scenario in the future.

Or alternatively, I suppose we can always just construct a new DicomDataset in memory that contains the minimal amount of needed tags for the unit test.

@gofal gofal merged commit f29b59d into development May 18, 2024
4 checks passed
@gofal gofal deleted the GH-1432-2bitsperpixel branch May 18, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Monochrome2 segmentation frames are not exported out correctly
3 participants