/// <summary> /// Creates and populates a <see cref="Volume"/> from the builder's source frames. /// </summary> public Volume Build() { var header = BuildVolumeHeader(); // N.B.: this method only creates ushort volumes because it normalizes all the source frames so that the modality LUTs, VOI LUTs, etc. are consistent // all pixel data is rescaled appropriately before filling the volume data array int minVolumeValue, maxVolumeValue; var volumeArray = BuildVolumeArray((ushort)header.PaddingValue, header.RescaleSlope, header.RescaleIntercept, out minVolumeValue, out maxVolumeValue); var volume = new U16Volume(volumeArray, header, minVolumeValue, maxVolumeValue); return(volume); }
private static void CreateAndResliceVolume(bool signed) { const int width = 10; const int height = 10; const int depth = 10; Volume vol; if (signed) { vol = new S16Volume(new short[width*height*depth], new Size3D(width, height, depth), new Vector3D(1, 1, 1), new Vector3D(0, 0, 0), Matrix3D.GetIdentity(), new DicomAttributeCollection(){ValidateVrLengths = false, ValidateVrValues = false}, short.MinValue); } else { vol = new U16Volume(new ushort[width*height*depth], new Size3D(width, height, depth), new Vector3D(1, 1, 1), new Vector3D(0, 0, 0), Matrix3D.GetIdentity(), new DicomAttributeCollection(), ushort.MinValue); } try { using (var volumeReference = vol.CreateReference()) { GetSlicePixelData(volumeReference, Matrix.GetIdentity(4), 20, 20, 0.5f, 0.5f, VolumeInterpolationMode.Linear); GetSlabPixelData(volumeReference, Matrix.GetIdentity(4), new Vector3D(0, 0, 1), 20, 20, 3, 0.5f, 0.5f, 1, VolumeInterpolationMode.Linear, VolumeProjectionMode.Average); } } finally { vol.Dispose(); } }
/// <summary> /// Creates and populates a <see cref="Volume"/> from the builder's source frames. /// </summary> public Volume Build() { var header = BuildVolumeHeader(); // N.B.: this method only creates ushort volumes because it normalizes all the source frames so that the modality LUTs, VOI LUTs, etc. are consistent // all pixel data is rescaled appropriately before filling the volume data array int minVolumeValue, maxVolumeValue; var volumeArray = BuildVolumeArray((ushort) header.PaddingValue, header.RescaleSlope, header.RescaleIntercept, out minVolumeValue, out maxVolumeValue); var volume = new U16Volume(volumeArray, header, minVolumeValue, maxVolumeValue); return volume; }