/// <summary> /// Constructs a new region of interest, specifying an <see cref="IPresentationImage"/> as the source of the pixel data. /// </summary> /// <param name="presentationImage">The image containing the source pixel data.</param> protected Roi(IPresentationImage presentationImage) { IImageGraphicProvider provider = presentationImage as IImageGraphicProvider; if (provider == null) return; _imageRows = provider.ImageGraphic.Rows; _imageColumns = provider.ImageGraphic.Columns; _presentationImage = presentationImage; _pixelData = provider.ImageGraphic.PixelData; if (presentationImage is IModalityLutProvider) _modalityLut = ((IModalityLutProvider) presentationImage).ModalityLut; if (presentationImage is IImageSopProvider) { Frame frame = ((IImageSopProvider) presentationImage).Frame; _normalizedPixelSpacing = frame.NormalizedPixelSpacing; _pixelAspectRatio = frame.PixelAspectRatio; _modality = frame.ParentImageSop.Modality; _modalityLutUnits = frame.RescaleUnits; _subnormalModalityLut = frame.IsSubnormalRescale; } else { _normalizedPixelSpacing = new PixelSpacing(0, 0); _pixelAspectRatio = new PixelAspectRatio(0, 0); _modalityLutUnits = RescaleUnits.None; _subnormalModalityLut = false; } }
public VolumeHeaderData(IList <IDicomAttributeProvider> sourceSops, Size3D arrayDimensions, Vector3D voxelSpacing, Vector3D volumePositionPatient, Matrix3D volumeOrientationPatient, int bitsAllocated, int bitsStored, bool isSigned, int paddingValue, double rescaleSlope, double rescaleIntercept, RescaleUnits rescaleUnits, string laterality = null) { Platform.CheckForNullReference(sourceSops, "sourceSops"); Platform.CheckTrue(sourceSops.Count > 0, "At least one sourceSop is required"); Platform.CheckForNullReference(arrayDimensions, "arrayDimensions"); Platform.CheckForNullReference(voxelSpacing, "voxelSpacing"); Platform.CheckForNullReference(volumePositionPatient, "originPatient"); Platform.CheckForNullReference(volumeOrientationPatient, "orientationPatient"); _volumeOrientationPatient = volumeOrientationPatient; var firstSop = sourceSops[0]; ArrayDimensions = arrayDimensions; VoxelSpacing = voxelSpacing; VolumePositionPatient = volumePositionPatient; VolumeOrientationPatientX = volumeOrientationPatient.GetRow(0); VolumeOrientationPatientY = volumeOrientationPatient.GetRow(1); VolumeOrientationPatientZ = volumeOrientationPatient.GetRow(2); Modality = firstSop[DicomTags.Modality].ToString(); SourceStudyInstanceUid = firstSop[DicomTags.StudyInstanceUid].ToString(); SourceSeriesInstanceUid = firstSop[DicomTags.SeriesInstanceUid].ToString(); FrameOfReferenceUid = firstSop[DicomTags.FrameOfReferenceUid].ToString(); BitsPerVoxel = bitsAllocated; Signed = isSigned; PaddingValue = paddingValue; RescaleSlope = rescaleSlope; RescaleIntercept = rescaleIntercept; RescaleUnits = rescaleUnits ?? RescaleUnits.None; Laterality = laterality ?? string.Empty; VolumeSize = new Vector3D(ArrayDimensions.Width * VoxelSpacing.X, ArrayDimensions.Height * VoxelSpacing.Y, ArrayDimensions.Depth * VoxelSpacing.Z); VolumeBounds = new Rectangle3D(new Vector3D(0, 0, 0), VolumeSize); VolumeCenter = 0.5f * VolumeBounds.Size; VolumeCenterPatient = ConvertToPatient(VolumeCenter); // populate the DICOM data set FillDataSet(_collection, sourceSops, bitsAllocated, bitsStored, isSigned, rescaleSlope, rescaleIntercept, laterality); }
/// <summary> /// Initializes the <see cref="Volume"/> using the specified volume data. /// </summary> /// <remarks> /// Consider using <see cref="Volume.Create(IDisplaySet)"/> or one of its overloads to automatically construct and fill a <see cref="Volume"/> of the appropriate type. /// </remarks> public U16Volume(ushort[] array, Size3D arrayDimensions, Vector3D voxelSpacing, Vector3D volumePositionPatient, Matrix3D volumeOrientationPatient, IList <IDicomAttributeProvider> dicomAttributeModel, int paddingValue, double rescaleSlope, double rescaleIntercept, RescaleUnits rescaleUnits) : this(array, new VolumeHeaderData(dicomAttributeModel, arrayDimensions, voxelSpacing, volumePositionPatient, volumeOrientationPatient, 16, 16, false, paddingValue, rescaleSlope, rescaleIntercept, rescaleUnits), null, null) { }
/// <summary> /// Initializes the <see cref="Volume"/> using the specified volume data. /// </summary> /// <remarks> /// Consider using <see cref="Volume.Create(IDisplaySet)"/> or one of its overloads to automatically construct and fill a <see cref="Volume"/> of the appropriate type. /// </remarks> public U16Volume(ushort[] array, Size3D arrayDimensions, Vector3D voxelSpacing, Vector3D volumePositionPatient, Matrix3D volumeOrientationPatient, IDicomAttributeProvider attributeProvider, int paddingValue, double rescaleSlope, double rescaleIntercept, RescaleUnits rescaleUnits) : this(array, arrayDimensions, voxelSpacing, volumePositionPatient, volumeOrientationPatient, new[] { attributeProvider }, paddingValue, rescaleSlope, rescaleIntercept, rescaleUnits) { }
public VolumeHeaderData(IList<IDicomAttributeProvider> sourceSops, Size3D arrayDimensions, Vector3D voxelSpacing, Vector3D volumePositionPatient, Matrix3D volumeOrientationPatient, int bitsAllocated, int bitsStored, bool isSigned, int paddingValue, double rescaleSlope, double rescaleIntercept, RescaleUnits rescaleUnits, string laterality = null) { Platform.CheckForNullReference(sourceSops, "sourceSops"); Platform.CheckTrue(sourceSops.Count > 0, "At least one sourceSop is required"); Platform.CheckForNullReference(arrayDimensions, "arrayDimensions"); Platform.CheckForNullReference(voxelSpacing, "voxelSpacing"); Platform.CheckForNullReference(volumePositionPatient, "originPatient"); Platform.CheckForNullReference(volumeOrientationPatient, "orientationPatient"); _volumeOrientationPatient = volumeOrientationPatient; var firstSop = sourceSops[0]; ArrayDimensions = arrayDimensions; VoxelSpacing = voxelSpacing; VolumePositionPatient = volumePositionPatient; VolumeOrientationPatientX = volumeOrientationPatient.GetRow(0); VolumeOrientationPatientY = volumeOrientationPatient.GetRow(1); VolumeOrientationPatientZ = volumeOrientationPatient.GetRow(2); Modality = firstSop[DicomTags.Modality].ToString(); SourceStudyInstanceUid = firstSop[DicomTags.StudyInstanceUid].ToString(); SourceSeriesInstanceUid = firstSop[DicomTags.SeriesInstanceUid].ToString(); FrameOfReferenceUid = firstSop[DicomTags.FrameOfReferenceUid].ToString(); BitsPerVoxel = bitsAllocated; Signed = isSigned; PaddingValue = paddingValue; RescaleSlope = rescaleSlope; RescaleIntercept = rescaleIntercept; RescaleUnits = rescaleUnits ?? RescaleUnits.None; Laterality = laterality ?? string.Empty; VolumeSize = new Vector3D(ArrayDimensions.Width*VoxelSpacing.X, ArrayDimensions.Height*VoxelSpacing.Y, ArrayDimensions.Depth*VoxelSpacing.Z); VolumeBounds = new Rectangle3D(new Vector3D(0, 0, 0), VolumeSize); VolumeCenter = 0.5f*VolumeBounds.Size; VolumeCenterPatient = ConvertToPatient(VolumeCenter); // populate the DICOM data set FillDataSet(_collection, sourceSops, bitsAllocated, bitsStored, isSigned, rescaleSlope, rescaleIntercept, laterality); }
/// <summary> /// Initializes the <see cref="Volume"/> using the specified volume data. /// </summary> /// <remarks> /// Consider using <see cref="Volume.Create(IDisplaySet)"/> or one of its overloads to automatically construct and fill a <see cref="Volume"/> of the appropriate type. /// </remarks> public U16Volume(ushort[] array, Size3D arrayDimensions, Vector3D voxelSpacing, Vector3D volumePositionPatient, Matrix3D volumeOrientationPatient, IList<IDicomAttributeProvider> dicomAttributeModel, int paddingValue, double rescaleSlope, double rescaleIntercept, RescaleUnits rescaleUnits) : this(array, new VolumeHeaderData(dicomAttributeModel, arrayDimensions, voxelSpacing, volumePositionPatient, volumeOrientationPatient, 16, 16, false, paddingValue, rescaleSlope, rescaleIntercept, rescaleUnits), null, null) {}
/// <summary> /// Initializes the <see cref="Volume"/> using the specified volume data. /// </summary> /// <remarks> /// Consider using <see cref="Volume.Create(IDisplaySet)"/> or one of its overloads to automatically construct and fill a <see cref="Volume"/> of the appropriate type. /// </remarks> public U16Volume(ushort[] array, Size3D arrayDimensions, Vector3D voxelSpacing, Vector3D volumePositionPatient, Matrix3D volumeOrientationPatient, IDicomAttributeProvider attributeProvider, int paddingValue, double rescaleSlope, double rescaleIntercept, RescaleUnits rescaleUnits) : this(array, arrayDimensions, voxelSpacing, volumePositionPatient, volumeOrientationPatient, new[] {attributeProvider}, paddingValue, rescaleSlope, rescaleIntercept, rescaleUnits) {}