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
Closed
@bakhtvar

Description

@bakhtvar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0