Пример #1
0
        //TODO (cr Oct 2009): return Slice, remove SeriesUID
        private VolumeSliceSopDataSource CreateSlice(int sliceIndex, Vector3D throughPoint)
        {
            float thicknessAndSpacing      = Math.Abs(GetSliceSpacing());
            VolumeSliceSopDataSource slice = new VolumeSliceSopDataSource(_volume.Volume, _slicerParams, throughPoint);

            slice[DicomTags.SliceThickness].SetFloat32(0, thicknessAndSpacing);
            slice[DicomTags.SpacingBetweenSlices].SetFloat32(0, thicknessAndSpacing);
            slice[DicomTags.SeriesInstanceUid].SetString(0, _seriesInstanceUid);
            slice[DicomTags.InstanceNumber].SetInt32(0, sliceIndex + 1);
            return(slice);
        }
Пример #2
0
			public VolumeSliceSopFrameData(int frameNumber, VolumeSliceSopDataSource parent) : base(frameNumber, parent) {}
Пример #3
0
		protected internal byte[] GetOverlay(Frame baseFrame, out OverlayFrameParams overlayFrameParams)
		{
			var volume = this.Volume;

			// compute the bounds of the target base image frame in patient coordinates
			var baseTopLeft = baseFrame.ImagePlaneHelper.ConvertToPatient(new PointF(0, 0));
			var baseTopRight = baseFrame.ImagePlaneHelper.ConvertToPatient(new PointF(baseFrame.Columns, 0));
			var baseBottomLeft = baseFrame.ImagePlaneHelper.ConvertToPatient(new PointF(0, baseFrame.Rows));
			var baseFrameCentre = (baseTopRight + baseBottomLeft)/2;

			// compute the rotated volume slicing basis axes
			var volumeXAxis = (volume.ConvertToVolume(baseTopRight) - volume.ConvertToVolume(baseTopLeft)).Normalize();
			var volumeYAxis = (volume.ConvertToVolume(baseBottomLeft) - volume.ConvertToVolume(baseTopLeft)).Normalize();
			var volumeZAxis = volumeXAxis.Cross(volumeYAxis);

			var @params = new VolumeSlicerParams(volumeXAxis, volumeYAxis, volumeZAxis);
			using (var slice = new VolumeSliceSopDataSource(volume, @params, volume.ConvertToVolume(baseFrameCentre)))
			{
				using (var sliceSop = new ImageSop(slice))
				{
					using (var overlayFrame = sliceSop.Frames[1])
					{
						// compute the bounds of the target overlay image frame in patient coordinates
						var overlayTopLeft = overlayFrame.ImagePlaneHelper.ConvertToPatient(new PointF(0, 0));
						var overlayTopRight = overlayFrame.ImagePlaneHelper.ConvertToPatient(new PointF(overlayFrame.Columns, 0));
						var overlayBottomLeft = overlayFrame.ImagePlaneHelper.ConvertToPatient(new PointF(0, overlayFrame.Rows));
						var overlayOffset = overlayTopLeft - baseTopLeft;

						// compute the overlay and base image resolution in pixels per unit patient space (mm).
						var overlayResolutionX = overlayFrame.Columns/(overlayTopRight - overlayTopLeft).Magnitude;
						var overlayResolutionY = overlayFrame.Rows/(overlayBottomLeft - overlayTopLeft).Magnitude;
						var baseResolutionX = baseFrame.Columns/(baseTopRight - baseTopLeft).Magnitude;
						var baseResolutionY = baseFrame.Rows/(baseBottomLeft - baseTopLeft).Magnitude;

						// compute parameters to register the overlay on the base image
						var scale = new PointF(baseResolutionX/overlayResolutionX, baseResolutionY/overlayResolutionY);
						var offset = new PointF(overlayOffset.X*overlayResolutionX, overlayOffset.Y*overlayResolutionY);

						//TODO (CR Sept 2010): could this be negative?
						// validate computed transform parameters
						Platform.CheckTrue(overlayOffset.Z < 0.5f, "Compute OffsetZ != 0");

						overlayFrameParams = new OverlayFrameParams(
							overlayFrame.Rows, overlayFrame.Columns,
							overlayFrame.BitsAllocated, overlayFrame.BitsStored,
							overlayFrame.HighBit, overlayFrame.PixelRepresentation != 0 ? true : false,
							overlayFrame.PhotometricInterpretation == PhotometricInterpretation.Monochrome1 ? true : false,
							overlayFrame.RescaleSlope, overlayFrame.RescaleIntercept,
							scale, offset);

						return overlayFrame.GetNormalizedPixelData();
					}
				}
			}
		}
Пример #4
0
		//TODO (cr Oct 2009): return Slice, remove SeriesUID
		private VolumeSliceSopDataSource CreateSlice(int sliceIndex, Vector3D throughPoint)
		{
			float thicknessAndSpacing = Math.Abs(GetSliceSpacing());
			VolumeSliceSopDataSource slice = new VolumeSliceSopDataSource(_volume.Clone(), _slicerParams, new[]{throughPoint});
			slice[DicomTags.SliceThickness].SetFloat32(0, thicknessAndSpacing);
			slice[DicomTags.SpacingBetweenSlices].SetFloat32(0, thicknessAndSpacing);
			slice[DicomTags.SeriesInstanceUid].SetString(0, _seriesInstanceUid);
			slice[DicomTags.InstanceNumber].SetInt32(0, sliceIndex + 1);
			return slice;
		}
 public VolumeSliceSopFrameData(int frameNumber, VolumeSliceSopDataSource parent)
     : base(frameNumber, parent)
 {
 }