private static VolumeSlice CreateSlice(IVolumeReference volumeReference, IVolumeSlicerParams slicerParams, float thicknessAndSpacing, Vector3D throughPoint) { // compute Rows and Columns to reflect actual output size var frameSize = GetSliceExtent(volumeReference, slicerParams); // compute Pixel Spacing var effectiveSpacing = GetEffectiveSpacing(volumeReference); // compute Image Orientation (Patient) var matrix = new Matrix(slicerParams.SlicingPlaneRotation); matrix[3, 0] = throughPoint.X; matrix[3, 1] = throughPoint.Y; matrix[3, 2] = throughPoint.Z; var resliceAxesPatientOrientation = volumeReference.RotateToPatientOrientation(matrix); // compute Image Position (Patient) var topLeftOfSlicePatient = GetTopLeftOfSlicePatient(frameSize, throughPoint, volumeReference, slicerParams); var args = new VolumeSliceArgs(frameSize.Height, frameSize.Width, effectiveSpacing, effectiveSpacing, new Vector3D(resliceAxesPatientOrientation[0, 0], resliceAxesPatientOrientation[0, 1], resliceAxesPatientOrientation[0, 2]), new Vector3D(resliceAxesPatientOrientation[1, 0], resliceAxesPatientOrientation[1, 1], resliceAxesPatientOrientation[1, 2]), thicknessAndSpacing, Convert(slicerParams.InterpolationMode)); return(new VolumeSlice(volumeReference, true, args, topLeftOfSlicePatient, thicknessAndSpacing)); }
private static VolumeSlice CreateSlice(IVolumeReference volumeReference, IVolumeSlicerParams slicerParams, float thicknessAndSpacing, Vector3D throughPoint) { // compute Rows and Columns to reflect actual output size var frameSize = GetSliceExtent(volumeReference, slicerParams); // compute Pixel Spacing var effectiveSpacing = GetEffectiveSpacing(volumeReference); // compute Image Orientation (Patient) var matrix = new Matrix(slicerParams.SlicingPlaneRotation); matrix[3, 0] = throughPoint.X; matrix[3, 1] = throughPoint.Y; matrix[3, 2] = throughPoint.Z; var resliceAxesPatientOrientation = volumeReference.RotateToPatientOrientation(matrix); // compute Image Position (Patient) var topLeftOfSlicePatient = GetTopLeftOfSlicePatient(frameSize, throughPoint, volumeReference, slicerParams); var args = new VolumeSliceArgs(frameSize.Height, frameSize.Width, effectiveSpacing, effectiveSpacing, new Vector3D(resliceAxesPatientOrientation[0, 0], resliceAxesPatientOrientation[0, 1], resliceAxesPatientOrientation[0, 2]), new Vector3D(resliceAxesPatientOrientation[1, 0], resliceAxesPatientOrientation[1, 1], resliceAxesPatientOrientation[1, 2]), thicknessAndSpacing, Convert(slicerParams.InterpolationMode)); return new VolumeSlice(volumeReference, true, args, topLeftOfSlicePatient, thicknessAndSpacing); }