private static float GetIdealSliceSpacing(IVolumeHeader volumeHeader, Vector3D unitSpacingAxis) { // the ideal spacing is simply the diagonal of the voxel projected on to the spacing axis // any larger than this value, and it becomes possible for an entire voxel to fit in between two consecutive output locations (i.e. missed for interpolation) // any smaller than this value, and some voxels will have two or more output locations within their bounds return(Math.Abs(unitSpacingAxis.Dot(volumeHeader.RotateToPatientOrientation(volumeHeader.VoxelSpacing)))); }
private static float GetIdealSliceSpacing(IVolumeHeader volumeHeader, Vector3D unitSpacingAxis) { // the ideal spacing is simply the diagonal of the voxel projected on to the spacing axis // any larger than this value, and it becomes possible for an entire voxel to fit in between two consecutive output locations (i.e. missed for interpolation) // any smaller than this value, and some voxels will have two or more output locations within their bounds // note: voxel actually has 4 possible diagonals depending on the orientation, so we do this calculation for all diagonals and take the largest one var p = volumeHeader.RotateToPatientOrientation(volumeHeader.VoxelSpacing); return(new[] { p, new Vector3D(-p.X, p.Y, p.Z), new Vector3D(p.X, -p.Y, p.Z), new Vector3D(-p.X, -p.Y, p.Z) } .Select(v => Math.Abs(unitSpacingAxis.Dot(v))).Max()); }
private static float GetIdealSliceSpacing(IVolumeHeader volumeHeader, Vector3D unitSpacingAxis) { // the ideal spacing is simply the diagonal of the voxel projected on to the spacing axis // any larger than this value, and it becomes possible for an entire voxel to fit in between two consecutive output locations (i.e. missed for interpolation) // any smaller than this value, and some voxels will have two or more output locations within their bounds // note: voxel actually has 4 possible diagonals depending on the orientation, so we do this calculation for all diagonals and take the largest one var p = volumeHeader.RotateToPatientOrientation(volumeHeader.VoxelSpacing); return new[] {p, new Vector3D(-p.X, p.Y, p.Z), new Vector3D(p.X, -p.Y, p.Z), new Vector3D(-p.X, -p.Y, p.Z)} .Select(v => Math.Abs(unitSpacingAxis.Dot(v))).Max(); }
private static float GetIdealSliceSpacing(IVolumeHeader volumeHeader, Vector3D unitSpacingAxis) { // the ideal spacing is simply the diagonal of the voxel projected on to the spacing axis // any larger than this value, and it becomes possible for an entire voxel to fit in between two consecutive output locations (i.e. missed for interpolation) // any smaller than this value, and some voxels will have two or more output locations within their bounds return Math.Abs(unitSpacingAxis.Dot(volumeHeader.RotateToPatientOrientation(volumeHeader.VoxelSpacing))); }