<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">Apologizes if it is another duplicate but I couldn’t find any relevant/recent information about my issue.</div><div class=""><br class=""></div><div class="">Is it possible to display image to world transform for an image in ITK?</div><div class=""><br class=""></div><div class="">I am trying to figure out how ITK handles the orientation for this Nifti file:</div><div class=""><a href="https://drive.google.com/open?id=0B2-PspfnvPNgY1R2SFFTd3YtaGM" class="">https://drive.google.com/open?id=0B2-PspfnvPNgY1R2SFFTd3YtaGM</a></div><div class=""><br class=""></div><div class="">The image to world transform I get if I compute it “manually" from the header or run it in Nibabel does not match Slicer's (which is based on ITK) [1]. Also, if I convert this Nifiti file to NRRD in ITK, the orientation returned by the NRRD header matches Slicer but not Nibabel.</div><div class=""><br class=""></div><div class="">SLICER:</div><div class=""><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">-0.859375 0 0 49.8438</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt;"><font color="#000096" class="">0 </font><b class=""><font color="#e63b7a" class="">-0.859375</font></b><font color="#000096" class=""> 0 -67.8906</font></span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">0 0 0.859375 -53.7109</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">0 0 0 1</span></div></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);"><br class=""></span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">NIBABEL:</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);"><div class="" style="font-size: 12px; margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures;">array([[ -0.859375 , 0. , 0. , 49.84375 ],</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 12px; margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures;"><font color="#ffffff" class=""> [ 0. , </font><font color="#e63b7a" class="">0.859375</font><font color="#ffffff" class=""> , 0. , -67.890625 ],</font></span></div><div class="" style="font-size: 12px; margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> [ 0. , 0. , 0.859375 , -53.7109375],</span></div><div class="" style="font-size: 12px; margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> [ 0. , 0. , 0. , 1. ]])</span></div></span></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">NRRD HEADER:</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">NRRD0004</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(109, 92, 251); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 2 </span><span style="font-variant-ligatures: no-common-ligatures" class=""># Complete NRRD file format specification at:</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(109, 92, 251); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 3 </span><span style="font-variant-ligatures: no-common-ligatures" class=""># <a href="http://teem.sourceforge.net/nrrd/format.html" class="">http://teem.sourceforge.net/nrrd/format.html</a></span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 4 </span><span style="font-variant-ligatures: no-common-ligatures" class="">type: float</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 5 </span><span style="font-variant-ligatures: no-common-ligatures" class="">dimension: 3</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 6 </span><span style="font-variant-ligatures: no-common-ligatures" class="">space: left-posterior-superior</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 7 </span><span style="font-variant-ligatures: no-common-ligatures" class="">sizes: 117 159 126</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 8 </span><span style="font-variant-ligatures: no-common-ligatures" class="">space directions: (0.859375,0,0) (0,0.859375,0) (0,0,0.859375)</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 9 </span><span style="font-variant-ligatures: no-common-ligatures" class="">kinds: domain domain domain</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 10 </span><span style="font-variant-ligatures: no-common-ligatures" class="">endian: little</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 11 </span><span style="font-variant-ligatures: no-common-ligatures" class="">encoding: raw</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c9c26c" class=""> 12 </span><span style="font-variant-ligatures: no-common-ligatures" class="">space origin: (-49.84375,67.890625,-53.7109375)</span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I understand the RAS/LPS differences but what doesn’t makes sense to me are the space directions in the NRRD header: -0.85 on the second vector would make sense to me:</div><div class=""><span style="color: rgb(255, 255, 255); font-family: Menlo; background-color: rgb(39, 40, 35);" class="">(0.859375,0,0) (0,</span><span style="font-family: Menlo; background-color: rgb(39, 40, 35);" class=""><font color="#e63b7a" class="">-0.859375</font></span><span style="color: rgb(255, 255, 255); font-family: Menlo; background-color: rgb(39, 40, 35);" class="">,0) (0,0,0.859375)</span></div><div class="">I would also expect slicer [0][0] and [1][1] indices to have opposite signs. (like Nibabel)</div><div class=""><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">-0.859375 0 0 49.8438</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt;"><font color="#000096" class="">0 </font><b class=""><font color="#e63b7a" class="">0.859375</font></b><font color="#000096" class=""> 0 -67.8906</font></span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">0 0 0.859375 -53.7109</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">0 0 0 1</span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I couldn’t track down where this modification happens in ITK.</div><div class="">Does ITK do any kind of correction to adjust the orientation somehow?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">As a test, I convert my Nifti to NRRD [2] and run the program step by step.</div><div class=""><br class=""></div><div class="">In the Nifti parser, one of the last steps is to set the “Direction” to: (NiftiImageIO::SetImageIOOrientationFromNIfTI - Around line 1700)</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Direction 0: [1,-0,0]</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Direction 1: [-0,-1,0]</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Direction 2: [0,0,1]</span></div></div><div class=""><br class=""></div><div class="">Then, when the NRRD parser tries fo fetch the direction it becomes: (NrrdImageIO::Write - Around line 945)</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Direction 0 [1,0,0]</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Direction 1 [0,1,0]</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Direction 2 [0,0,1]</span></div></div><div class=""><br class=""></div><div class="">I couldn’t track down where this is happening or if that even makes sense.</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Nicolas</div><div class=""><br class=""></div><div class="">[1]</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">-------------------------------------------------------</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> nifti_1_header :</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> sizeof_hdr = 348</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> data_type[10] = 0x 0 0 0 0 0 0 0 0 0 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> db_name[18] = 0x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> extents = 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> session_error = 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> regular = 0x72</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> dim_info = 0x0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> dim[8] = 4 117 159 126 15 1 1 1</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> intent_p1 = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> intent_p2 = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> intent_p3 = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> intent_code = NIFTI_INTENT_NONE</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> datatype = 16</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> bitpix = 32</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> slice_start = 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> pixdim[8] = -1.000000 0.859375 0.859375 0.859375</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> 1.000000 0.000000 0.000000 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> vox_offset = 352.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> scl_slope = 1.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> scl_inter = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> slice_end = 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> slice_code = 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> xyzt_units = 0x12</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> cal_max = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> cal_min = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> slice_duration = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> toffset = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> glmax = 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> glmin = 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> descrip = ''</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> aux_file = ''</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> qform_code = 1</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> sform_code = 0</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> quatern_b = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> quatern_c = 1.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> quatern_d = 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> qoffset_x = 49.843750</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> qoffset_y = -67.890625</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> qoffset_z = -53.710938</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> srow_x[4] = 0.000000, 0.000000, 0.000000, 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> srow_y[4] = 0.000000, 0.000000, 0.000000, 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> srow_z[4] = 0.000000, 0.000000, 0.000000, 0.000000</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> intent_name = ''</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> magic = 'n+1'</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">———————————————————————————</span></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">SLICER</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">>>> import slicer</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">>>> vol = slicer.util.getNode('template_T2.nii')</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">>>> IJKToRASMat = vtk.vtkMatrix4x4()</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">>>> vol.GetIJKToRASMatrix(IJKToRASMat);</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">>>> print(IJKToRASMat)</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">vtkMatrix4x4 (0x140294910)</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">Debug: Off</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">Modified Time: 980729</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">Reference Count: 1</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">Registered Events: (none)</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">Elements:</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">-0.859375 0 0 49.8438</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt;"><font color="#000096" class="">0 </font><b class=""><font color="#e63b7a" class="">-0.859375</font></b><font color="#000096" class=""> 0 -67.8906</font></span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">0 0 0.859375 -53.7109</span></div><div class="" style="margin: 0px;"><span class="" style="font-family: Courier; font-size: 12pt; color: rgb(0, 0, 150);">0 0 0 1</span></div></div><div class=""><br class=""></div><div class="">NIBABEL</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(109, 92, 251);">In [<b class="">2</b>]: </span><span class="" style="font-variant-ligatures: no-common-ligatures;">example_filename = '/Users/nico/work/gitroot/ami/data/nifti/FetalAtlas/template_T2.nii.gz'</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35); min-height: 14px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(109, 92, 251);">In [<b class="">3</b>]: </span><span class="" style="font-variant-ligatures: no-common-ligatures;">import nibabel as nib</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35); min-height: 14px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(109, 92, 251);">In [<b class="">4</b>]: </span><span class="" style="font-variant-ligatures: no-common-ligatures;">img = nib.load(example_filename)</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35); min-height: 14px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(109, 92, 251);">In [<b class="">5</b>]: </span><span class="" style="font-variant-ligatures: no-common-ligatures;">img.shape</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(221, 88, 115);">Out[<b class="">5</b>]: </span><span class="" style="font-variant-ligatures: no-common-ligatures;">(117, 159, 126, 15)</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35); min-height: 14px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(109, 92, 251);">In [<b class="">6</b>]: </span><span class="" style="font-variant-ligatures: no-common-ligatures;">img.affine</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(221, 88, 115); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures;">Out[<b class="">6</b>]: </span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures;">array([[ -0.859375 , 0. , 0. , 49.84375 ],</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures;"><font color="#ffffff" class=""> [ 0. , </font><font color="#e63b7a" class="">0.859375</font><font color="#ffffff" class=""> , 0. , -67.890625 ],</font></span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> [ 0. , 0. , 0.859375 , -53.7109375],</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);"><span class="" style="font-variant-ligatures: no-common-ligatures;"> [ 0. , 0. , 0. , 1. ]])</span></div></div><div class=""><br class=""></div><div class="">[2]</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(39, 40, 35);" class=""><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> typedef itk::Image<float, 3> InputImageType;</font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> typedef itk::Image<float, 3> OutputImageType;</font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""><br class=""></font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> typedef itk::ImageFileReader<InputImageType> ReaderType;</font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> typedef itk::ImageFileWriter<OutputImageType> WriterType;</font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""><br class=""></font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> ReaderType::Pointer reader = ReaderType::New();</font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> WriterType::Pointer writer = WriterType::New();</font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""><br class=""></font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> reader->SetFileName( "/Users/nico/work/gitroot/data/nifti/fetalatlas_brain/t2/template_T2.nii.gz" );</font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""><br class=""></font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> writer->SetFileName( "test.nrrd" );</font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> writer->SetInput( reader->GetOutput() );</font></div><div style="font-family: Helvetica;" class=""><font color="#ffffff" style="font-size: 14px;" class=""> writer->Update();</font></div></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">[3]</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(39, 40, 35);" class=""><br class=""></div></div></body></html>