Exemple #1
0
            /// <summary>
            /// Creates the <see cref="VolumeHeaderData"/> for the builder's source frames.
            /// </summary>
            /// <returns></returns>
            public VolumeHeaderData BuildVolumeHeader()
            {
                if (_volumeHeaderData != null)
                {
                    return(_volumeHeaderData);
                }

                PrepareFrames(_frames);                 // this also sorts the frames into order by slice location

                // compute modality LUT parameters normalized for all frames
                double normalizedSlope, normalizedIntercept;
                var    normalizedUnits = _frames[0].Frame.RescaleUnits;

                ComputeNormalizedModalityLut(_frames, out normalizedSlope, out normalizedIntercept);

                // determine an appropriate pixel padding value
                var pixelPaddingValue = ComputePixelPaddingValue(_frames, normalizedSlope, normalizedIntercept);

                // get the laterality of the anatomy being constructed
                var laterality = _frames[0].Frame.Laterality;

                // Construct a model SOP data source based on the first frame's DICOM header
                var header = new VolumeHeaderData(_frames.Select(f => (IDicomAttributeProvider)f.Frame).ToList(), VolumeSize, VoxelSpacing, VolumePositionPatient, VolumeOrientationPatient, 16, 16, false, pixelPaddingValue, normalizedSlope, normalizedIntercept, normalizedUnits, laterality);

                // determine how the normalized modality LUT affects VOI windows and update the header
                VoiWindow.SetWindows(ComputeAggregateNormalizedVoiWindows(_frames, normalizedSlope, normalizedIntercept), header);

                return(_volumeHeaderData = header);
            }
Exemple #2
0
 public CachedVolume(VolumeCache cacheOwner, CacheKey cacheKey, IEnumerable <Frame> frames)
 {
     _cacheOwner       = cacheOwner;
     _cacheKey         = cacheKey;
     _frames           = frames.Select(f => f.CreateTransientReference()).ToList();
     _volumeHeaderData = Volume.BuildHeader(_frames);
 }
Exemple #3
0
        /// <summary>
        /// Initializes the <see cref="Volume"/>.
        /// </summary>
        /// <param name="volumeHeaderData"></param>
        /// <param name="minVolumeValue"></param>
        /// <param name="maxVolumeValue"></param>
        internal Volume(VolumeHeaderData volumeHeaderData, int?minVolumeValue, int?maxVolumeValue)
        {
            Platform.CheckForNullReference(volumeHeaderData, "volumeHeader");

            _volumeHeaderData = volumeHeaderData;
            _minVolumeValue   = minVolumeValue;
            _maxVolumeValue   = maxVolumeValue;
        }
Exemple #4
0
		/// <summary>
		/// Initializes the <see cref="Volume"/>.
		/// </summary>
		/// <param name="volumeHeaderData"></param>
		/// <param name="minVolumeValue"></param>
		/// <param name="maxVolumeValue"></param>
		internal Volume(VolumeHeaderData volumeHeaderData, int? minVolumeValue, int? maxVolumeValue)
		{
			Platform.CheckForNullReference(volumeHeaderData, "volumeHeader");

			_volumeHeaderData = volumeHeaderData;
			_minVolumeValue = minVolumeValue;
			_maxVolumeValue = maxVolumeValue;
		}
 internal U16Volume(ushort[] array, VolumeHeaderData volumeHeaderData, int?minVolumeValue, int?maxVolumeValue)
     : base(volumeHeaderData, minVolumeValue, maxVolumeValue)
 {
     _array = array;
 }
 internal S8Volume(sbyte[] array, VolumeHeaderData volumeHeaderData, int?minVolumeValue, int?maxVolumeValue)
     : base(volumeHeaderData, minVolumeValue, maxVolumeValue)
 {
     _array = array;
 }
			/// <summary>
			/// Creates the <see cref="VolumeHeaderData"/> for the builder's source frames.
			/// </summary>
			/// <returns></returns>
			public VolumeHeaderData BuildVolumeHeader()
			{
				if (_volumeHeaderData != null) return _volumeHeaderData;

				PrepareFrames(_frames); // this also sorts the frames into order by slice location

				// compute modality LUT parameters normalized for all frames
				double normalizedSlope, normalizedIntercept;
				var normalizedUnits = _frames[0].Frame.RescaleUnits;
				ComputeNormalizedModalityLut(_frames, out normalizedSlope, out normalizedIntercept);

				// determine an appropriate pixel padding value
				var pixelPaddingValue = ComputePixelPaddingValue(_frames, normalizedSlope, normalizedIntercept);

				// get the laterality of the anatomy being constructed
				var laterality = _frames[0].Frame.Laterality;

				// Construct a model SOP data source based on the first frame's DICOM header
				var header = new VolumeHeaderData(_frames.Select(f => (IDicomAttributeProvider) f.Frame).ToList(), VolumeSize, VoxelSpacing, VolumePositionPatient, VolumeOrientationPatient, 16, 16, false, pixelPaddingValue, normalizedSlope, normalizedIntercept, normalizedUnits, laterality);

				// determine how the normalized modality LUT affects VOI windows and update the header
				VoiWindow.SetWindows(ComputeAggregateNormalizedVoiWindows(_frames, normalizedSlope, normalizedIntercept), header);

				return _volumeHeaderData = header;
			}
		internal U16Volume(ushort[] array, VolumeHeaderData volumeHeaderData, int? minVolumeValue, int? maxVolumeValue)
			: base(volumeHeaderData, minVolumeValue, maxVolumeValue)
		{
			_array = array;
		}
Exemple #9
0
 public Vector3D RotateToVolumeOrientation(Vector3D patientVector)
 {
     return(VolumeHeaderData.RotateToVolumeOrientation(patientVector));
 }
		internal S8Volume(sbyte[] array, VolumeHeaderData volumeHeaderData, int? minVolumeValue, int? maxVolumeValue)
			: base(volumeHeaderData, minVolumeValue, maxVolumeValue)
		{
			_array = array;
		}
Exemple #11
0
 public Vector3D RotateToPatientOrientation(Vector3D volumeVector)
 {
     return(VolumeHeaderData.RotateToPatientOrientation(volumeVector));
 }
Exemple #12
0
 public Matrix RotateToVolumeOrientation(Matrix patientOrientation)
 {
     return(VolumeHeaderData.RotateToVolumeOrientation(patientOrientation));
 }
Exemple #13
0
 public Matrix3D RotateToPatientOrientation(Matrix3D volumeOrientation)
 {
     return(VolumeHeaderData.RotateToPatientOrientation(volumeOrientation));
 }
Exemple #14
0
 public Vector3D ConvertToVolume(Vector3D patientPosition)
 {
     return(VolumeHeaderData.ConvertToVolume(patientPosition));
 }
Exemple #15
0
 public Vector3D ConvertToPatient(Vector3D volumePosition)
 {
     return(VolumeHeaderData.ConvertToPatient(volumePosition));
 }