2 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
19 public int texWidth {
protected set;
get; }
20 public int texHeight {
protected set;
get; }
21 public int texDepth {
protected set;
get; }
42 public Image
image {
protected set;
get; }
45 public Vector3
origin {
protected set;
get; }
50 public Vector3
sliceOffset {
get {
return seriesInfo.sliceOffset;} }
101 Matrix4x4 transformMatrix =
new Matrix4x4 ();
103 transformMatrix [0, 0] = directionCosineX.x * pixelSpacing.x;
104 transformMatrix [1, 0] = directionCosineX.y * pixelSpacing.x;
105 transformMatrix [2, 0] = directionCosineX.z * pixelSpacing.x;
106 transformMatrix [3, 0] = 0f;
108 transformMatrix [0, 1] = directionCosineY.x * pixelSpacing.y;
109 transformMatrix [1, 1] = directionCosineY.y * pixelSpacing.y;
110 transformMatrix [2, 1] = directionCosineY.z * pixelSpacing.y;
111 transformMatrix [3, 1] = 0f;
113 transformMatrix [0, 2] = sliceOffset.x;
114 transformMatrix [1, 2] = sliceOffset.y;
115 transformMatrix [2, 2] = sliceOffset.z;
116 transformMatrix [3, 2] = 0f;
118 transformMatrix [0, 3] = origin.x;
119 transformMatrix [1, 3] = origin.y;
120 transformMatrix [2, 3] = origin.z;
121 transformMatrix [3, 3] = 1f;
124 Matrix4x4 rightHandToLeftHand =
new Matrix4x4 ();
125 rightHandToLeftHand [0, 0] = 1f;
126 rightHandToLeftHand [1, 1] = 1f;
127 rightHandToLeftHand [2, 2] = -1f;
128 rightHandToLeftHand [3, 3] = 1f;
140 Vector4 p =
new Vector4 (pixel.x, pixel.y, layer, 1f);
142 return new Vector3 (pos.x, pos.y, pos.z);
153 Vector4 p =
new Vector4 (pos.x, pos.y, pos.z, 1f);
155 return new Vector3 (pixel.x, pixel.y, pixel.z);
166 Vector3 rounded =
new Vector3 (Mathf.Round (pixel.x),
167 Mathf.Round (pixel.y),
168 Mathf.Round (pixel.z));
173 public static Color32
F2C(UInt32 value)
175 Color32 c =
new Color32 ();
186 c.a = (byte)(value >> 24);
187 c.b = (byte)(value >> 16);
188 c.g = (byte)(value >> 8);
DICOM(DICOMSeries seriesInfo)
Vector3 transformPatientPosToPixel(Vector3 pos)
Vector3 transformPatientPosToDiscretePixel(Vector3 pos)
void setupTransformationMatrices()
static Color32 F2C(UInt32 value)
Vector3 transformPixelToPatientPos(Vector2 pixel, float layer=0)