<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">The target region is the region (index and size) you set in the resample filter. It is just a difference in terminology between you and me.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I took a look at the images you supplied. Because of transformations, this is hard to debug.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I realized it would be easier to construct the output image to be in the same physical space as the input image, and have identity transform applied to resample filter (used by default). Pseudo-code:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">ImageType::DirectionType dir;</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">ST.normalize();</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">dir[0]=ST; //vector from first point to second</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">vec3 second=normal.cross(ST); //make the second vector orthogonal to first and the normal</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">second.normalize();</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">dir[1]=second;</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">normal.normalize();</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">dir[2]=normal;</font></div><div class="gmail_default"><font face="monospace, monospace">filter->SetOutputDirection(dir);<br></font></div><div class="gmail_default"><font face="monospace, monospace">filter->SetOrigin(traj_start);</font></div><div class="gmail_default"><font face="monospace, monospace">//it will be more math to compute proper size (so that resampled image ends at traj_end), and proper spacing (project original spacing onto coordinate system established by new dir matrix or use isotropic spacing equal to cubic root of sp[0]*sp[1]*sp[2]).</font></div><div class="gmail_default"><span style="font-family:verdana,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:verdana,sans-serif">With this approach you can use e.g. <a href="https://www.slicer.org/">Slicer</a> to look at both the original and resampled images, and also define fiducial points for your 3 points of interest.</span></div><div class="gmail_default"><font face="verdana, sans-serif"><br></font></div><div class="gmail_default"><font face="verdana, sans-serif">P.S. If you share any more images, please save them with compression applied (</font><font face="monospace, monospace">writer->SetUseCompression(true);</font><font face="verdana, sans-serif">).</font></div><div class="gmail_default"><font face="verdana, sans-serif"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Regards,</div><div class="gmail_default"><font face="verdana, sans-serif">Dženan Zukić, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.)</font></div></div></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 13, 2017 at 11:33 AM, sidharta <span dir="ltr"><<a href="mailto:sidharta.gupta93@gmail.com" target="_blank">sidharta.gupta93@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So if you think the code is correct and is doing what you suggested (or what<br>
I think it should do using the eulerTransform), you mentioned setting<br>
targetRegionIndex in ResampleFilter to get one single slice. I don't see<br>
this targetRegionIndex or do you mean set origin. I am going to send you the<br>
link to the dropbox folder in a private mail.<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://itk-users.7.n7.nabble.com/Extract-slice-from-ResampleFilter-tp38074p38118.html" rel="noreferrer" target="_blank">http://itk-users.7.n7.nabble.<wbr>com/Extract-slice-from-<wbr>ResampleFilter-tp38074p38118.<wbr>html</a><br>
<div class="HOEnZb"><div class="h5">Sent from the ITK - Users mailing list archive at Nabble.com.<br>
______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br></div>