<div dir="ltr"><div><br>Here it is:<br><b><br>// STD libraries:<br>#include <iostream><br>#include <string><br>// ITK libraries:<br>#include "itkImage.h"<br>#include "itkImageFileReader.h"<br>
#include "itkImageFileWriter.h"<br>
#include "itkExtractImageFilter.h"<br>#include "itkAnalyzeImageIO.h"<br>#include "itkOrientImageFilter.h"<br>#include "itkSize.h"<br><br></b></div><b>// Type def.<br></b><div><b>typedef unsigned char InputImage;<br>
typedef unsigned char OutputImage;<br><br>// Image def.::<br>typedef itk::Image<InputAnalyzeImage, 3> Image3D;<br>typedef itk::Image<OutputJPGImage, 2> Image2D;<br><br>typedef itk::ImageFileReader<</b><b>Analyze3DImage> Reader3D;<br>
typedef itk::ImageFileWriter<</b><b>JPG2DImage> Writer2D;<br>typedef itk::ExtractImageFilter<</b><b>Image3D, Image2D> Filter3D;<br><br>Image2D::Pointer extract2DSlice(Image3D::</b><b>Pointer buffer, int plane, int slice)<br>
{<br> Filter3D::Pointer filter = Filter3D::New();<br>
Image3D::RegionType inputRegion = buffer-></b><b>GetLargestPossibleRegion();<br><br> Image3D::SizeType size = inputRegion.GetSize();<br> size[plane] = 0;<br> Image3D::IndexType start = inputRegion.GetIndex();<br>
const unsigned int sliceNumber = slice;<br> start[plane] = sliceNumber;<br><br></b></div><div><b> // The problem is HERE!<br></b></div><div><b> Image3D::RegionType desiredRegion;<br> desiredRegion.SetSize(size);<br>
desiredRegion.SetIndex(start);<br>
<br> filter->SetExtractionRegion(</b><b>desiredRegion);<br> filter->SetInput(buffer);<br><br> Image2D::Pointer img = filter->GetOutput();<br> return img;<br>}</b><br></div><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On 16 August 2013 16:21, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">If you post a small, minimal example that with all includes, perhaps we can help.<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Fri, Aug 16, 2013 at 3:17 PM, Gabriel Santiago <span dir="ltr"><<a href="mailto:santiago.eletrica@gmail.com" target="_blank">santiago.eletrica@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div><div><div>Dear all,<br><br></div>I am trying to reproduce the example of page 118, of the itkSoftwareGuide, changing<br>
<br><i>typedef itk::ImageMaskSpatialObject<3> ImageMaskSpatialObject;</i><br>
<br></div>to<br><br><b>typedef itk::Image<InputAnalyzeImage, 3> Image3D;</b><br><br></div>I think it should work, but when I come to the following lines<br><br><b> Image3D::SizeType size = inputRegion.GetSize();<br>
size[plane] = 0;<br> Image3D::IndexType start = inputRegion.GetIndex();<br> const unsigned int sliceNumber = slice;<br> start[plane] = sliceNumber;<br><br> Image3D::RegionType desiredRegion;<br> desiredRegion.SetSize(size);<br>
desiredRegion.SetIndex(start);</b><br><br>I am getting the following error messages:<br><br></div><b>Invalid argumentes:<br></b></div><b>Candidates are:<br></b></div><b>void SetSize(const itk::Size<<unknown>>&) and<br>
void SetSize(unsigned long int, unsigned long int)<br><br><br>Invalid argumentes:<br>Candidates are:<br>void SetIndex(const itk::Index<<unknown>>&) and<br>void SetIndex(unsigned long int, unsigned long int)<br>
</b><div><div><div><div><br clear="all"><div><div><div><div>Can anyone, please, help me? I am using itk v4.2.<br></div><div>What is going on?<br><br></div><div>Thanks in advance,<span><font color="#888888"><br>
</font></span></div><span><font color="#888888"><div><br>-- <br>Gabriel Santiago<br>
<br>~"As long as I live so long do I learn"~<div>Ramakhrishna</div>
</div></font></span></div></div></div></div></div></div></div></div>
<br></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://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br>Gabriel Santiago<br>Engenheiro de Computação - Serviço de Informática/ Hospital das Clínicas de São Paulo<br><a href="mailto:santiago.eletrica@gmail.com" target="_blank">santiago.eletrica@gmail.com</a><br>
Cel.: +55 11 99801-0881<br><br>~"As long as I live so long do I learn"~<div>Ramakhrishna</div>
</div>