8000 Recent code caused problem. · Issue #1975 · fo-dicom/fo-dicom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Recent code caused problem. #1975

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

Open
bakhtvar opened this issue May 18, 2025 · 2 comments
Open

Recent code caused problem. #1975

bakhtvar opened this issue May 18, 2025 · 2 comments
Labels

Comments

@bakhtvar
Copy link

Recent update on the code..
`
var options = new GrayscaleRenderOptions(bits)
{
RescaleSlope = dataset.Contains(DicomTag.RescaleSlope)
? dataset.GetSingleValue(DicomTag.RescaleSlope)
: functional.Contains(DicomTag.RescaleSlope)
? functional.GetSingleValue(DicomTag.RescaleSlope)
: 1.0,
RescaleIntercept = dataset.Contains(DicomTag.RescaleIntercept)
? dataset.GetSingleValue(DicomTag.RescaleIntercept)
: functional.Contains(DicomTag.RescaleIntercept)
? functional.GetSingleValue(DicomTag.RescaleIntercept)
: 0.0,

            WindowWidth = windowWidth,
            WindowCenter = windowCenter,
            VOILUTFunction = voiLutFunction,
            ColorMap = GetColorMap(dataset)
        };

caused problem with files who has RescaleSlope/Intercept, but no value provided. better to change it like..
if (!dataset.TryGetSingleValue(DicomTag.RescaleSlope, out var rescaleSclope))
{
if (!functional.TryGetSingleValue(DicomTag.RescaleSlope, out rescaleSclope))
{
rescaleSclope = 1.0;
}
}

        if (!dataset.TryGetSingleValue<double>(DicomTag.RescaleIntercept, out var rescaleIntercept))
        {
            if (!functional.TryGetSingleValue<double>(DicomTag.RescaleIntercept, out rescaleIntercept))
            {
                rescaleIntercept = 1.0;
            }
        }

        var options = new GrayscaleRenderOptions(bits)
        {
            RescaleSlope = rescaleSclope,
            RescaleIntercept = rescaleIntercept,
            WindowWidth = windowWidth,
            WindowCenter = windowCenter,
            VOILUTFunction = voiLutFunction,
            ColorMap = GetColorMap(dataset)
        };

`
Sample problematic file attached.
RescaleTag.zip

@bakhtvar bakhtvar added the new label May 18, 2025
@gofal
Copy link
Contributor
gofal commented May 21, 2025

This file is invalid:

Image

Both RescaleSlope and RescaleIntercept require a ValueMultiplicity of 1. that means, if the tag is present, then it must contain a value.
https://dicom.innolitics.com/ciods/digital-x-ray-image/dx-image/00281053

@gofal
Copy link
Contributor
gofal commented May 21, 2025

will change the code, so that also this kind of invalid files are handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0