private static List <VoiDataLut> Create(DicomAttributeSQ voiLutSequence, int pixelRepresentation) { bool isFirstMappedPixelSigned = pixelRepresentation != 0; List <DataLut> dataLuts = DataLut.Create(voiLutSequence, isFirstMappedPixelSigned, false); return(Convert(dataLuts)); }
protected void DeserializeSoftcopyVoiLut(SoftcopyVoiLutModuleIod module, T image) { SoftcopyVoiLutModuleIod.SoftcopyVoiLutSequenceItem[] lutSequences = module.SoftcopyVoiLutSequence; if (lutSequences == null) { return; } DicomVoiLuts voiLuts = (DicomVoiLuts)image.DicomVoiLuts; voiLuts.ReinitializePresentationLuts(this.PresentationSopInstanceUid); foreach (SoftcopyVoiLutModuleIod.SoftcopyVoiLutSequenceItem lutSequence in lutSequences) { ImageSopInstanceReferenceDictionary dictionary = new ImageSopInstanceReferenceDictionary(lutSequence.ReferencedImageSequence, true); if (dictionary.ReferencesFrame(image.ImageSop.SopInstanceUid, image.Frame.FrameNumber)) { if (lutSequence.CountWindows > 0) { double[] widths = lutSequence.WindowWidth; double[] centers = lutSequence.WindowCenter; int countWindows = Math.Min(widths.Length, centers.Length); string[] explanation = lutSequence.WindowCenterWidthExplanation; if (explanation == null || explanation.Length < countWindows) { explanation = new string[countWindows]; } if (lutSequence.VoiLutFunction == VoiLutFunction.Sigmoid) { Platform.Log(LogLevel.Warn, "Sigmoid LUTs are not currently supported."); } else // default is linear { for (int n = 0; n < countWindows; n++) { voiLuts.AddPresentationLinearLut(widths[n], centers[n], explanation[n]); } } } if (lutSequence.CountDataLuts > 0) { foreach (VoiLutSequenceItem item in lutSequence.VoiLutSequence) { DataLutIod dl = DataLutIod.Create(item.DicomSequenceItem, item.DicomAttributeProvider[DicomTags.LutDescriptor] is DicomAttributeSS, false); voiLuts.AddPresentationDataLut(new VoiDataLut(dl.FirstMappedPixelValue, dl.BitsPerEntry, dl.Data, dl.Explanation)); } } } } }
internal static ModalityDataLut Create(DicomAttributeSQ modalityLutSequence, int pixelRepresentation) { List <DataLut> data = DataLut.Create(modalityLutSequence, pixelRepresentation != 0, false); if (data.Count == 0) { return(null); } string modalityLutType = ((DicomSequenceItem[])modalityLutSequence.Values)[0][DicomTags.ModalityLutType].ToString(); return(new ModalityDataLut(data[0], modalityLutType)); }
private static List <VoiDataLut> Create(DicomAttributeSQ voiLutSequence, int bitsStored, int pixelRepresentation, double rescaleSlope, double rescaleIntercept) { int minPixelValue; int maxPixelValue; bool isSigned = pixelRepresentation != 0; GetMinMaxPixelValue(bitsStored, isSigned, out minPixelValue, out maxPixelValue); double minModalityLutValue = minPixelValue * rescaleSlope + rescaleIntercept; double maxModalityLutValue = maxPixelValue * rescaleSlope + rescaleIntercept; bool isFirstMappedPixelValueSigned = minModalityLutValue < 0 || maxModalityLutValue < 0; List <DataLut> dataLuts = DataLut.Create(voiLutSequence, isFirstMappedPixelValueSigned, false); return(Convert(dataLuts)); }
public DataLut(DataLut item) : this(item.FirstMappedPixelValue, item.BitsPerEntry, (int[])item.Data.Clone(), item.Explanation, item.MinOutputValue, item.MaxOutputValue) { }
protected ModalityDataLut(DataLut dataLut, string modalityLutType) : base(dataLut.FirstMappedPixelValue, dataLut.BitsPerEntry, dataLut.Data, dataLut.Explanation, dataLut.MinOutputValue, dataLut.MaxOutputValue) { _modalityLutType = modalityLutType; }
protected VoiDataLut(DataLut dataLut) : base(dataLut.FirstMappedPixelValue, dataLut.BitsPerEntry, dataLut.Data, dataLut.Explanation, dataLut.MinOutputValue, dataLut.MaxOutputValue) { }