<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>You can use the Image::GetBufferedRegion method and print the resulting ImageRegion.</div><div><br></div><div>This looks like there is a pipelining issue to me. I'd recommend trying to simplify by not reusing the Image data object. Yes you will need to recompute, but it may help to narrow down the problem.</div><div><br></div><div>Brad</div><div><br></div><div><br></div><div><div><br><div><div>On Sep 8, 2015, at 3:06 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 know the input and desired regions, not sure how to look for the buffered region.</div><div><br></div><div>1. Reviewing my code I saw I didn't set the input image for the extracter, so I added:</div><div>extracter->SetInput(image);</div><div><br></div><div>Good, right? But no. Still the same error.</div><div><br></div><div>2. Then I tried switching to itkExtractImageFilter, and I got:</div><div><span style="font-family: Courier; font-size: 10pt;">Exception at 0x7633c42d, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) at c:\itk-4.8.0-installed\include\itk-4.8\itkextractimagefilter.hxx:242</span><br></div><div><span style="font-family: Courier; font-size: 10pt;"><br></span></div><div>So I had to look inside this code (why don't throw me more info in the try catch?) to see what's happening, and I read this:<span style="font-family: Courier; font-size: 10pt;"><br></span></div><div><table class="" style="border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-family:Helvetica,arial,nimbussansl,liberationsans,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:13px;line-height:18.2px"><tbody><tr><td id="LC242" class="" style="padding:0px 10px;vertical-align:top;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre;overflow:visible;word-wrap:normal"><span class="" style="color:rgb(0,134,179)">itkExceptionMacro</span>( << <span class="" style="color:rgb(24,54,145)"><span class="">"</span>It is required that the strategy for collapsing the direction matrix be explicitly specified. <span class="">"
<table class="" style="white-space:normal;border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-family:Helvetica,arial,nimbussansl,liberationsans,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:13px;line-height:18.2px"><tbody><tr><td id="LC243" class="" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;padding:0px 10px;vertical-align:top;font-size:12px;white-space:pre;overflow:visible;word-wrap:normal"><< <span class="" style="color:rgb(24,54,145)"><span class="">"</span>Set with either myfilter->SetDirectionCollapseToIdentity() or myfilter->SetDirectionCollapseToSubmatrix() <span class="">"
<table class="" style="line-height:18.2px;white-space:normal;border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-family:Helvetica,arial,nimbussansl,liberationsans,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:13px"><tbody><tr><td id="L244" class="" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; padding: 0px 10px; width: 50px; min-width: 50px; white-space: nowrap; font-size: 12px; line-height: 18px; vertical-align: top; text-align: right; border-style: solid; border-color: rgb(238, 238, 238); border-width: 0px 1px 0px 0px;"></td><td id="LC244" class="" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;padding:0px 10px;vertical-align:top;font-size:12px;white-space:pre;overflow:visible;word-wrap:normal"> << <span class="" style="color:rgb(0,134,179)">typeid</span>( ImageBase< InputImageDimension > * ).<span class="" style="color:rgb(0,134,179)">name</span>() );</td></tr></tbody></table><span style="line-height:18.2px"></span>
</span></span></td></tr></tbody></table>
</span></span></td></tr></tbody></table></div><div><div>3. I also tried to insert a:</div><div>image->Update();</div><div>or</div><div>image->UpdateOutputData();</div><div>with same results.</div><div><br></div><div>I was thinking about passing the reader, but I'd like to apply changes to my image, so this method would receive a modified copy (no DeepCopy method like in vtk?)</div></div><div><br></div><div><br></div><div>Yes, the input image is connected to a pipeline:</div><div>itk::Image -> itk::<span style="color:rgb(128,0,128)">ImageToVTKImageFilter -> vtk::</span><span style="color:rgb(128,0,128)">vtkImageFlip -> vtkImageData -> vtkImageViewer2</span></div><div><span style="color:rgb(128,0,128)"><br></span></div><div><span style="color:rgb(128,0,128)"><br></span></div><div>Thanks again for your interest.<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-08 16:16 GMT+02:00 Bradley Lowekamp <span dir="ltr"><<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">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><div class="h5"><div>On Sep 7, 2015, at 5:21 PM, Marcos <<a href="mailto:fotosentido@gmail.com" target="_blank">fotosentido@gmail.com</a>> wrote:</div><br></div></div><blockquote type="cite"><div><div class="h5"><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>::</span><span>exportOriginal</span><span>(</span><span style="color:rgb(128,0,128)">QString</span><span style="color:rgb(192,192,192)"> </span><span>fileName</span><span>,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ImageType</span><span>::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span>image</span><span>,</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>frame</span><span>)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span>{</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>::</span><span style="color:rgb(128,0,128)">ImageFileWriter</span><span><</span><span style="color:rgb(128,0,128)">FrameImageType</span><span>></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">WriterType</span><span>;</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>::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span>writer</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">WriterType</span><span>::</span><span>New</span><span>();</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>writer</span><span>-></span><span style="font-style:italic">SetFileName</span><span>(</span><span>fileName</span><span>.</span><span>toStdString</span><span>().</span><span>c_str</span><span>());</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>::</span><span style="color:rgb(128,0,128)">RegionType</span><span style="color:rgb(192,192,192)"> </span><span>inputRegion</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span>image</span><span>-></span><span style="font-style:italic">GetLargestPossibleRegion</span><span>();</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>::</span><span style="color:rgb(128,0,128)">IndexType</span><span style="color:rgb(192,192,192)"> </span><span>index</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span>inputRegion</span><span>.</span><span>GetIndex</span><span>();</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>::</span><span style="color:rgb(128,0,128)">SizeType</span><span style="color:rgb(192,192,192)"> </span><span>size</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span>inputRegion</span><span>.</span><span>GetSize</span><span>();</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>index</span><span>[</span><span style="color:rgb(0,0,128)">0</span><span>]</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span>;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span>index</span><span>[</span><span style="color:rgb(0,0,128)">1</span><span>]</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span>;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span>index</span><span>[</span><span style="color:rgb(0,0,128)">2</span><span>]</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span>frame</span><span>;</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>size</span><span>[</span><span style="color:rgb(0,0,128)">2</span><span>]</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span>;</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>::</span><span style="color:rgb(128,0,128)">RegionType</span><span style="color:rgb(192,192,192)"> </span><span>outputRegion</span><span>;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span>outputRegion</span><span>.</span><span>SetIndex</span><span>(</span><span>index</span><span>);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span>outputRegion</span><span>.</span><span>SetSize</span><span>(</span><span>size</span><span>);</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>::</span><span style="color:rgb(128,0,128)">Testing</span><span>::</span><span style="color:rgb(128,0,128)">ExtractSliceImageFilter</span><span><</span><span style="color:rgb(128,0,128)">ImageType</span><span>,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">FrameImageType</span><span>></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ExtractType</span><span>;</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>::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span>extracter</span><span style="color:rgb(192,192,192)"> </span><span>=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ExtractType</span><span>::</span><span>New</span><span>();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span>extracter</span><span>-></span><span>SetExtractionRegion</span><span>(</span><span>outputRegion</span><span>);</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>writer</span><span>-></span><span>SetInput</span><span>(</span><span>extracter</span><span>-></span><span>GetOutput</span><span>());</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>{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span>writer</span><span>-></span><span style="font-style:italic">Update</span><span>();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span>}</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>(</span><span style="color:rgb(128,0,128)">itk</span><span>::</span><span style="color:rgb(128,0,128)">ExceptionObject</span><span style="color:rgb(192,192,192)"> </span><span>&</span><span>ex</span><span>)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span>{</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>:</span>cerr<span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span>ex</span><span style="color:rgb(192,192,192)"> </span><span><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span>::</span>endl<span>;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span>}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span>}</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 style="color:rgb(24,54,145);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre-wrap"><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-wrap">Largest possible region does not fully contain requested paste IO region</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-wrap">"</span><br></div><div><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-wrap"><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></div></div>
_____________________________________<br>Powered by <a href="http://www.kitware.com/" 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" target="_blank">http://www.kitware.com/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" target="_blank">http://www.kitware.com/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" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br></blockquote></div><br></div></div></blockquote></div><br></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></div></body></html>