public void FromDataset_WindowCenterWidth_ReturnsSameAsFromWindowLevel( ushort bitsAllocated, ushort bitsStored, ushort pixelRepresentation, double rescaleSlope, double rescaleIntercept, double windowWidth, double windowCenter, string voiLutFunction) { var dataset = new DicomDataset( new DicomCodeString(DicomTag.PhotometricInterpretation, "MONOCHROME1"), new DicomUnsignedShort(DicomTag.BitsAllocated, bitsAllocated), new DicomUnsignedShort(DicomTag.BitsStored, bitsStored), new DicomUnsignedShort(DicomTag.PixelRepresentation, pixelRepresentation), new DicomDecimalString(DicomTag.RescaleSlope, (decimal)rescaleSlope), new DicomDecimalString(DicomTag.RescaleIntercept, (decimal)rescaleIntercept), new DicomDecimalString(DicomTag.WindowWidth, (decimal)windowWidth), new DicomDecimalString(DicomTag.WindowCenter, (decimal)windowCenter), new DicomCodeString(DicomTag.VOILUTFunction, voiLutFunction)); var expected = GrayscaleRenderOptions.FromWindowLevel(dataset); var actual = GrayscaleRenderOptions.FromDataset(dataset); Assert.Equal(expected.WindowWidth, actual.WindowWidth); Assert.Equal(expected.WindowCenter, actual.WindowCenter); }
public void FromWindowLevel_ValidInput_CorrectOutput( ushort bitsAllocated, ushort bitsStored, ushort pixelRepresentation, double rescaleSlope, double rescaleIntercept, double windowWidth, double windowCenter, string voiLutFunction) { var dataset = new DicomDataset( new DicomUnsignedShort(DicomTag.BitsAllocated, bitsAllocated), new DicomUnsignedShort(DicomTag.BitsStored, bitsStored), new DicomUnsignedShort(DicomTag.PixelRepresentation, pixelRepresentation), new DicomDecimalString(DicomTag.RescaleSlope, (decimal)rescaleSlope), new DicomDecimalString(DicomTag.RescaleIntercept, (decimal)rescaleIntercept), new DicomDecimalString(DicomTag.WindowWidth, (decimal)windowWidth), new DicomDecimalString(DicomTag.WindowCenter, (decimal)windowCenter), new DicomCodeString(DicomTag.VOILUTFunction, voiLutFunction)); var actual = GrayscaleRenderOptions.FromWindowLevel(dataset); Assert.Equal(windowWidth, actual.WindowWidth); Assert.Equal(windowCenter, actual.WindowCenter); }