示例#1
0
        //TODO (cr Oct 2009): can be factored out into Slice class.

        // VTK treats the reslice point as the center of the output image. Given the plane orientation
        //	and size of the output image, we can derive the top left of the output image in patient space
        private static Vector3D GetTopLeftOfSlicePatient(Size frameSize, Vector3D throughPoint, Volume volume, IVolumeSlicerParams slicerParams)
        {
            // This is the center of the output image
            PointF centerImageCoord = new PointF(frameSize.Width / 2f, frameSize.Height / 2f);

            // These offsets define the x and y vector magnitudes to arrive at our point
            float effectiveSpacing = GetEffectiveSpacing(volume);
            float offsetX          = centerImageCoord.X * effectiveSpacing;
            float offsetY          = centerImageCoord.Y * effectiveSpacing;

            // To determine top left of slice in volume, subtract offset vectors along x and y
            //
            // Our reslice place x and y vectors
            Matrix   resliceAxes = slicerParams.SlicingPlaneRotation;
            Vector3D xVec        = new Vector3D(resliceAxes[0, 0], resliceAxes[0, 1], resliceAxes[0, 2]);
            Vector3D yVec        = new Vector3D(resliceAxes[1, 0], resliceAxes[1, 1], resliceAxes[1, 2]);
            // Offset along x and y from reslicePoint
            Vector3D topLeftOfSliceVolume = throughPoint - (offsetX * xVec + offsetY * yVec);

            // Convert volume point to patient space
            return(volume.ConvertToPatient(topLeftOfSliceVolume));
        }
示例#2
0
		//TODO (cr Oct 2009): can be factored out into Slice class.

		// VTK treats the reslice point as the center of the output image. Given the plane orientation
		//	and size of the output image, we can derive the top left of the output image in patient space
		private static Vector3D GetTopLeftOfSlicePatient(Size frameSize, Vector3D throughPoint, Volume volume, IVolumeSlicerParams slicerParams)
		{
			// This is the center of the output image
			PointF centerImageCoord = new PointF(frameSize.Width/2f, frameSize.Height/2f);

			// These offsets define the x and y vector magnitudes to arrive at our point
			float effectiveSpacing = GetEffectiveSpacing(volume);
			float offsetX = centerImageCoord.X*effectiveSpacing;
			float offsetY = centerImageCoord.Y*effectiveSpacing;

			// To determine top left of slice in volume, subtract offset vectors along x and y
			//
			// Our reslice place x and y vectors
			Matrix resliceAxes = slicerParams.SlicingPlaneRotation;
			Vector3D xVec = new Vector3D(resliceAxes[0, 0], resliceAxes[0, 1], resliceAxes[0, 2]);
			Vector3D yVec = new Vector3D(resliceAxes[1, 0], resliceAxes[1, 1], resliceAxes[1, 2]);
			// Offset along x and y from reslicePoint
			Vector3D topLeftOfSliceVolume = throughPoint - (offsetX*xVec + offsetY*yVec);

			// Convert volume point to patient space
			return volume.ConvertToPatient(topLeftOfSliceVolume);
		}