Description
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