/// <summary> /// Initialize new instance of <seealso cref="GenericGrayscalePipeline"/> which consist of the following sequence /// Rescale (Modality) LUT -> VOI LUT -> Output LUT and optionally Invert LUT if specified by grayscale options /// </summary> /// <param name="options">Grayscale options to use in the pipeline</param> public GenericGrayscalePipeline(GrayscaleRenderOptions options) { _options = options; if (options.ModalityLUTSequence != null) { _modalityLut = new ModalitySequenceLUT(_options); } else if (_options.RescaleSlope != 1.0 || _options.RescaleIntercept != 0.0) { _modalityLut = new ModalityRescaleLUT(_options); } if (_options.UseVOILUT && options.VOILUTSequence != null) { _voiSequenceLut = new VOISequenceLUT(_options); _voiLut = new VOILinearLUT(GrayscaleRenderOptions.CreateLinearOption(_options.BitDepth, _voiSequenceLut.MinimumOutputValue, _voiSequenceLut.MaximumOutputValue)); } else { _voiLut = VOILUT.Create(_options); } _outputLut = new OutputLUT(_options); if (_options.Invert) { _invertLut = new InvertLUT(_outputLut.MinimumOutputValue, _outputLut.MaximumOutputValue); } }
public void ColorMap_Monochrome2ImageOptions_ReturnsMonochrome2ColorMap() { var file = DicomFile.Open(TestData.Resolve("CT1_J2KI")); var options = GrayscaleRenderOptions.FromDataset(file.Dataset); var lut = new OutputLUT(options); Assert.Same(ColorTable.Monochrome2, lut.ColorMap); }
public GenericGrayscalePipeline(double slope, double intercept, int bitsStored, bool signed) { int minValue = signed ? -(1 << (bitsStored - 1)) : 0; int maxValue = signed ? (1 << (bitsStored - 1)) : (1 << (bitsStored + 1) - 1); _rescaleLut = new RescaleLUT(minValue, maxValue, slope, intercept); _voiLut = new VOILinearLUT(new WindowLevel(maxValue - minValue, (minValue + maxValue) / 2)); _outputLut = new OutputLUT(ColorTable.Monochrome2); }
/// <summary> /// Initialize new instance of <seealso cref="GenericGrayscalePipeline"/> which consist of the following sequence /// Rescale (Modality) LUT -> VOI LUT -> Output LUT and optionally Invert LUT if specified by grayscale options /// </summary> /// <param name="options">Grayscale options to use in the pipeline</param> public GenericGrayscalePipeline(GrayscaleRenderOptions options) { if (options.RescaleSlope != 1.0 || options.RescaleIntercept != 0.0) { _rescaleLut = new ModalityLUT(options); } _voiLut = VOILUT.Create(options); _outputLut = new OutputLUT(options.Monochrome1 ? ColorTable.Monochrome1 : ColorTable.Monochrome2); if (options.Invert) { _invertLut = new InvertLUT(_outputLut.MinimumOutputValue, _outputLut.MaximumOutputValue); } }
/// <summary> /// Initialize new instance of <seealso cref="GenericGrayscalePipeline"/> which consist of the following sequence /// Rescale (Modality) LUT -> VOI LUT -> Output LUT and optionally Invert LUT if specified by grayscale options /// </summary> /// <param name="options">Grayscale options to use in the pipeline</param> public GenericGrayscalePipeline(GrayscaleRenderOptions options) { _options = options; if (_options.RescaleSlope != 1.0 || _options.RescaleIntercept != 0.0) { _rescaleLut = new ModalityLUT(_options); } _voiLut = VOILUT.Create(_options); _outputLut = new OutputLUT(_options); if (_options.Invert) { _invertLut = new InvertLUT(_outputLut.MinimumOutputValue, _outputLut.MaximumOutputValue); } }
public GenericGrayscalePipeline(GrayscaleRenderOptions options) { if (options.RescaleSlope != 1.0 || options.RescaleIntercept != 0.0) { _rescaleLut = new RescaleLUT(options.BitDepth.MinimumValue, options.BitDepth.MaximumValue, options.RescaleSlope, options.RescaleIntercept); } _voiLut = new VOILinearLUT(options.WindowCenter, options.WindowWidth); _outputLut = new OutputLUT(options.Monochrome1 ? ColorTable.Monochrome1 : ColorTable.Monochrome2); if (options.Invert) { _invertLut = new InvertLUT(_outputLut.MinimumOutputValue, _outputLut.MaximumOutputValue); } }