dlwpt-code icon indicating copy to clipboard operation
dlwpt-code copied to clipboard

Ch10.10 dsets.py Why do you convert to 3x3 matrix?

Open cmosguy opened this issue 3 years ago • 0 comments

In the function for reading in the XYZ space of the CT .mhd file, why do you convert to 3x3 matrix?

class Ct:
  def __init__(self, series_uid):
    mhd_path = glob.glob('data-unversioned/part2/luna/subset*/{}.mhd'.format(series_uid))[0]
 
        ct_mhd = sitk.ReadImage(mhd_path)
        # ... line 91
        self.origin_xyz = XyzTuple(*ct_mhd.GetOrigin())
        self.vxSize_xyz = XyzTuple(*ct_mhd.GetSpacing())
        self.direction_a = np.array(ct_mhd.GetDirection()).reshape(3, 3)

I see the text to Converts the directions to an array, and reshapes the nine-element array to it's proper 3x3 matrix but why is 3x3 matrix for xyz?

cmosguy avatar May 15 '22 22:05 cmosguy