<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hello,</span></div><div><br><span></span></div><div><span>Actually I found that I can handle this problem by using itkRegionOfInterestImageFiler, it works quite well, except it started to truncate the image from the opposite of the desired direction. Then I tried to set its index, but it gave me this error:</span></div><div><span><br></span></div><div>********************************************<br><span></span></div><div><span>Requested region is (at least partially) outside the largest possible region</span></div><div>********************************************</div><div><br></div><div><br><span></span></div><div><span>I've already used "UpdateLargestPossibleRegion()" method, here is the partial
 code:</span></div><div><span><br></span></div><div>********************************************<br><span></span></div><div><span>reader-&gt;SetFileName(argv[1]);<br>&nbsp; reader-&gt;Update();<br>&nbsp; reader-&gt;UpdateLargestPossibleRegion();</span></div><div><br><span></span></div><div><span>&nbsp; ImageType::RegionType desiredRegion;<br>&nbsp; desiredRegion.SetSize(size);<br>&nbsp; desiredRegion.SetIndex(start);<br>&nbsp;<br>&nbsp; filter-&gt;SetRegionOfInterest(desiredRegion);<br>&nbsp; filter-&gt;SetInput(reader-&gt;GetOutput());<br><br>&nbsp; WriterType::Pointer writer = WriterType::New();<br>&nbsp; writer-&gt;SetFileName ( argv[2] );<br>&nbsp; writer-&gt;SetInput ( filter-&gt;GetOutput() );<br>&nbsp; writer-&gt;Update();</span></div><div>********************************************<br><span></span></div><div><br><span></span></div><div><span>Can anyone help? Thanks in advance. </span></div><div><br></div>  <div style="font-family: times new
 roman,new york,times,serif; font-size: 12pt;"> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight: bold;">From:</span></b> John Drescher &lt;drescherjm@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Insight Users &lt;insight-users@itk.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, February 28, 2012 4:05 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [Insight-users] Fwd:  How to Truncate Dicom Series?<br> </font> </div> <br>
---------- Forwarded message ----------<br>From: Abayiz &lt;<a ymailto="mailto:abayiz@yahoo.com" href="mailto:abayiz@yahoo.com">abayiz@yahoo.com</a>&gt;<br>Date: Tue, Feb 28, 2012 at 7:44 AM<br>Subject: Re: [Insight-users] How to Truncate Dicom Series?<br>To: John Drescher &lt;<a ymailto="mailto:drescherjm@gmail.com" href="mailto:drescherjm@gmail.com">drescherjm@gmail.com</a>&gt;<br><br><br>Hi,<br><br>I didn't find any way to do that as you suggested. Seems like there is<br>no way to set the index for the itkImageWriter. Am I doing wrong?<br><br>________________________________<br>From: John Drescher &lt;<a ymailto="mailto:drescherjm@gmail.com" href="mailto:drescherjm@gmail.com">drescherjm@gmail.com</a>&gt;<br>To: Abayiz &lt;<a ymailto="mailto:abayiz@yahoo.com" href="mailto:abayiz@yahoo.com">abayiz@yahoo.com</a>&gt;<br>Cc: alex Dowson &lt;<a ymailto="mailto:alexdowson@hotmail.com" href="mailto:alexdowson@hotmail.com">alexdowson@hotmail.com</a>&gt;; itk
 &lt;<a ymailto="mailto:insight-users@itk.org" href="mailto:insight-users@itk.org">insight-users@itk.org</a>&gt;<br>Sent: Tuesday, February 28, 2012 2:22 PM<br><br>Subject: Re: [Insight-users] How to Truncate Dicom Series?<br><br>&gt; Thank you for your reply. I also checked that example, but it starts to read<br>&gt; all the images, but I want to give up some slices of the original data. Any<br>&gt; suggestions?<br>&gt;<br>Read the series and then write it truncated.<br><br>John<br><br><br><br><br>-- <br>John M. Drescher<br>_____________________________________<br>Powered by <a target="_blank" href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br>http://www.kitware.com/opensource/opensource.html<br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.html<br><br>Please keep messages on-topic and check the ITK FAQ
 at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br><br><br> </div> </div>  </div></body></html>