<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hello,<div><br></div><div>What is the buffered region for the input image? Is the input image connected to a pipeline?</div><div><br></div><div>Perhaps you just forgot to update the input image before running this function?</div><div><br></div><div>Brad</div><div><br><div><div>On Sep 7, 2015, at 5:21 PM, Marcos <<a href="mailto:fotosentido@gmail.com">fotosentido@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Hi,<div><br></div><div>I have a method that was exporting fine one frame from my itk::Image.</div><div><br></div><div>My method:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Exporter</span><span style="">::</span><span style="">exportOriginal</span><span style="">(</span><span style="color:rgb(128,0,128)">QString</span><span style="color:rgb(192,192,192)"> </span><span style="">fileName</span><span style="">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ImageType</span><span style="">::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span style="">image</span><span style="">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="">frame</span><span style="">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span style="">::</span><span style="color:rgb(128,0,128)">ImageFileWriter</span><span style=""><</span><span style="color:rgb(128,0,128)">FrameImageType</span><span style="">></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">WriterType</span><span style="">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">WriterType</span><span style="">::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span style="">writer</span><span style="color:rgb(192,192,192)"> </span><span style="">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">WriterType</span><span style="">::</span><span style="">New</span><span style="">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">writer</span><span style="">-></span><span style="font-style: italic;">SetFileName</span><span style="">(</span><span style="">fileName</span><span style="">.</span><span style="">toStdString</span><span style="">().</span><span style="">c_str</span><span style="">());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ImageType</span><span style="">::</span><span style="color:rgb(128,0,128)">RegionType</span><span style="color:rgb(192,192,192)"> </span><span style="">inputRegion</span><span style="color:rgb(192,192,192)"> </span><span style="">=</span><span style="color:rgb(192,192,192)"> </span><span style="">image</span><span style="">-></span><span style="font-style: italic;">GetLargestPossibleRegion</span><span style="">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ImageType</span><span style="">::</span><span style="color:rgb(128,0,128)">IndexType</span><span style="color:rgb(192,192,192)"> </span><span style="">index</span><span style="color:rgb(192,192,192)"> </span><span style="">=</span><span style="color:rgb(192,192,192)"> </span><span style="">inputRegion</span><span style="">.</span><span style="">GetIndex</span><span style="">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ImageType</span><span style="">::</span><span style="color:rgb(128,0,128)">SizeType</span><span style="color:rgb(192,192,192)"> </span><span style="">size</span><span style="color:rgb(192,192,192)"> </span><span style="">=</span><span style="color:rgb(192,192,192)"> </span><span style="">inputRegion</span><span style="">.</span><span style="">GetSize</span><span style="">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">index</span><span style="">[</span><span style="color:rgb(0,0,128)">0</span><span style="">]</span><span style="color:rgb(192,192,192)"> </span><span style="">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">index</span><span style="">[</span><span style="color:rgb(0,0,128)">1</span><span style="">]</span><span style="color:rgb(192,192,192)"> </span><span style="">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">index</span><span style="">[</span><span style="color:rgb(0,0,128)">2</span><span style="">]</span><span style="color:rgb(192,192,192)"> </span><span style="">=</span><span style="color:rgb(192,192,192)"> </span><span style="">frame</span><span style="">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><font color="#008000">3D to 2D</font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">size</span><span style="">[</span><span style="color:rgb(0,0,128)">2</span><span style="">]</span><span style="color:rgb(192,192,192)"> </span><span style="">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ImageType</span><span style="">::</span><span style="color:rgb(128,0,128)">RegionType</span><span style="color:rgb(192,192,192)"> </span><span style="">outputRegion</span><span style="">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">outputRegion</span><span style="">.</span><span style="">SetIndex</span><span style="">(</span><span style="">index</span><span style="">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">outputRegion</span><span style="">.</span><span style="">SetSize</span><span style="">(</span><span style="">size</span><span style="">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span style="">::</span><span style="color:rgb(128,0,128)">Testing</span><span style="">::</span><span style="color:rgb(128,0,128)">ExtractSliceImageFilter</span><span style=""><</span><span style="color:rgb(128,0,128)">ImageType</span><span style="">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">FrameImageType</span><span style="">></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ExtractType</span><span style="">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ExtractType</span><span style="">::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span style="">extracter</span><span style="color:rgb(192,192,192)"> </span><span style="">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ExtractType</span><span style="">::</span><span style="">New</span><span style="">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">extracter</span><span style="">-></span><span style="">SetExtractionRegion</span><span style="">(</span><span style="">outputRegion</span><span style="">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">writer</span><span style="">-></span><span style="">SetInput</span><span style="">(</span><span style="">extracter</span><span style="">-></span><span style="">GetOutput</span><span style="">());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">try</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">writer</span><span style="">-></span><span style="font-style: italic;">Update</span><span style="">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">catch</span><span style="color:rgb(192,192,192)"> </span><span style="">(</span><span style="color:rgb(128,0,128)">itk</span><span style="">::</span><span style="color:rgb(128,0,128)">ExceptionObject</span><span style="color:rgb(192,192,192)"> </span><span style="">&</span><span style="">ex</span><span style="">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">std</span><span style="">:</span>cerr<span style="color:rgb(192,192,192)"> </span><span style=""><<</span><span style="color:rgb(192,192,192)"> </span><span style="">ex</span><span style="color:rgb(192,192,192)"> </span><span style=""><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span style="">::</span>endl<span style="">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="">}</span></pre></div><div><br></div><div>as inputRegion, I have:</div><div>index: [0, 0, 0]</div><div>size: [512, 512, 12]</div><div><br></div><div>as outputRegion, I have:</div><div>index: [0, 0, 1] # first frame</div><div>size: [512, 512, 0]</div><div><br></div><div><br></div><div><br></div><div>But I'm not sure what happened, now with every image I got an exception:</div><div><span class="" style="color:rgb(24,54,145);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre"><span style="font-family: Courier; font-size: 10pt; line-height: normal;">itkimagefilewriter.hxx:287: </span>"</span><span style="color:rgb(24,54,145);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre">Largest possible region does not fully contain requested paste IO region</span><span class="" style="color:rgb(24,54,145);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre">"</span><br></div><div><span class="" style="color:rgb(24,54,145);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre"><br></span></div><div><div>By the way, my try catch is not getting the exception message, I had to look inside the writer class.</div><div>Any ideas? Thank you.</div></div></div>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<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://public.kitware.com/mailman/listinfo/insight-users<br></blockquote></div><br></div></body></html>