<div dir="ltr">Hi,<div><br></div><div>I can't use unsigned char reading files, cause I'm seeing horrible views on my viewer for some files.</div><div>I'm gonna have to avoid using the itk exporter, and start using the vtk exporter, which doesn't have these problems.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-09 18:21 GMT+02:00 Marcos <span dir="ltr"><<a href="mailto:fotosentido@gmail.com" target="_blank">fotosentido@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ok, finally, I got it.<div><br></div><div>I left the duplicated thing, but it wasn't the pipeline.</div><div><br></div><div>I didn't see a warning from compiler, and the exception message didn't give me that clue:</div><div>the pixeltype I was using.</div><div><br></div><div><br></div><div>A lot of examples are using <b>unsigned short </b>or <b>signed short</b>, right? So I was.</div><div>Reviewing the source code on the imageio classes:</div><div><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">"</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">BMPImageIO supports unsigned char only</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">"</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">JPEG supports unsigned char/int only</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">"</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">PNG supports unsigned char and unsigned short</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><br></div><div><div>I just changed to <b>unsigned char</b>, and everything works fine.</div><div>Thanks for all the ideas, I really appreciate it. It's not easy trying to help without all the info.</div><div>I didn't realise the problem was outside my method. Sorry.</div></div><div><br></div><div>It takes some time to get things working, but it's great when it happens.</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-09-09 17:36 GMT+02:00 Marcos <span dir="ltr"><<a href="mailto:fotosentido@gmail.com" target="_blank">fotosentido@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>GetBufferedRegion gives me the same numbers as GetLargestPossibleRegion:</div><span><div>index: 0, 0, 0</div><div>size: 512, 512, 12</div><div><br></div></span><div>I also tried, just after reading the image, using ImageDuplicator:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">reader</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ReaderType</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</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)">reader</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetFileName</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">fileName</span><span style="color:rgb(0,0,0)">);</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,0)">dicomIO</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">GDCMImageIO</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</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="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">ImageDuplicator</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ImageType</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">DuplicatorType</span><span style="color:rgb(0,0,0)">;</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)">DuplicatorType</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">duplicator</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">DuplicatorType</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></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,0)">reader</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetImageIO</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">dicomIO</span><span style="color:rgb(0,0,0)">);</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="color:rgb(0,0,0)">{</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)">reader</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">Update</span><span style="color:rgb(0,0,0)">();</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)">image</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">reader</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">GetOutput</span><span style="color:rgb(0,0,0)">();</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><span style="color:rgb(0,128,0)">duplicar</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">imagen</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">duplicator</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetInputImage</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">image</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">duplicator</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">Update</span><span style="color:rgb(0,0,0)">();</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)">imageToSave</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">duplicator</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetOutput</span><span style="color:rgb(0,0,0)">();</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">     }</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">     catch</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">     ...</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><div style="font-family:arial,sans-serif;white-space:normal">None worked.</div><div style="font-family:arial,sans-serif;white-space:normal"><br></div><div style="font-family:arial,sans-serif;white-space:normal">I saw the ExtractImageFilter example, so I changed to extracter->SetDirectionCollapseToSubmatrix() instead of <span style="color:rgb(0,0,0)">SetDirectionCollapseToIdentity</span><span style="color:rgb(0,0,0)">().</span></div><div style="font-family:arial,sans-serif;white-space:normal"><span style="color:rgb(0,0,0)"><br></span></div><div><span style="font-family:arial,sans-serif;white-space:normal;color:rgb(0,0,0)">The filename is "</span><font color="#000000" face="arial, sans-serif"><span style="white-space:normal">C:/Users/M/r.png", in Windows.</span></font></div><div style="font-family:arial,sans-serif;white-space:normal"><span style="color:rgb(0,0,0)">Nothing. Same error.</span></div><div style="font-family:arial,sans-serif;white-space:normal"><br></div><div style="font-family:arial,sans-serif;white-space:normal"><span style="color:rgb(0,0,0)">bmp: </span><span style="color:rgb(0,0,0);font-family:Courier;font-size:10pt">itkbmpimageio.cxx:727</span></div><div style="font-family:arial,sans-serif;white-space:normal"><span style="color:rgb(0,0,0)">jpg: </span><span style="color:rgb(0,0,0);font-family:Courier;font-size:10pt">itkjpegimageio.cxx:454</span></div><div style="font-family:arial,sans-serif;white-space:normal"><span style="color:rgb(0,0,0)">png: </span><span style="color:rgb(0,0,0);font-family:Courier;font-size:10pt">itkpngimageio.cxx:521</span></div><div style="font-family:arial,sans-serif;white-space:normal"><span style="color:rgb(0,0,0);font-family:Courier;font-size:10pt"><br></span></div><div style="font-family:arial,sans-serif;white-space:normal"><span style="color:rgb(0,0,0)">By the way, it would be better if the exception messages were captured in my writer's try catch. I have to dive into these sources.</span><br></div><div style="font-family:arial,sans-serif;white-space:normal"><span style="color:rgb(0,0,0)"><br></span></div></pre></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-08 22:05 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>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><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" target="_blank">fotosentido@gmail.com</a>> wrote:</div><br><blockquote type="cite"><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 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 style="padding:0px 10px;vertical-align:top;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;white-space:pre-wrap;overflow:visible;word-wrap:normal"><span style="color:rgb(0,134,179)">itkExceptionMacro</span>( << <span style="color:rgb(24,54,145)"><span>"</span>It is required that the strategy for collapsing the direction matrix be explicitly specified. <span>"
<table 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 style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;padding:0px 10px;vertical-align:top;font-size:12px;white-space:pre-wrap;overflow:visible;word-wrap:normal"><< <span style="color:rgb(24,54,145)"><span>"</span>Set with either myfilter->SetDirectionCollapseToIdentity() or myfilter->SetDirectionCollapseToSubmatrix() <span>"
<table 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 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 style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;padding:0px 10px;vertical-align:top;font-size:12px;white-space:pre-wrap;overflow:visible;word-wrap:normal">            << <span style="color:rgb(0,134,179)">typeid</span>( ImageBase< InputImageDimension > * ).<span 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><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><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" 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></div></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>