<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks all<div><br><div>For the quick response I manage to do what I wanted using a templated filter just like Jon said. </div>
</div><div><br></div><div>What I do was </div><div><br></div><div><div>typedef typename InputImageType::PixelType PixelType;</div>
<div>typedef itk::Vector< PixelType, itk::GetImageDimension<InputImageType>::ImageDimension > VectorPixelType;</div><div>typedef itk::Vector< VectorPixelType, itk::GetImageDimension<InputImageType>::ImageDimension > MatrixPixelType;</div>
<div>typedef itk::SymmetricSecondRankTensor< PixelType, itk::GetImageDimension<InputImageType>::ImageDimension > TensorPixelType;</div><div> </div><div>typedef itk::Image< TensorPixelType, itk::GetImageDimension<InputImageType>::ImageDimension > TensorImageType;</div>
</div><div><br></div><div>and it worked just Fine.</div><div><br></div><div>Thanks again</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 3, 2014 at 12:45 PM, Jon Haitz Legarreta <span dir="ltr"><<a href="mailto:jhlegarreta@vicomtech.org" target="_blank">jhlegarreta@vicomtech.org</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"><div><div><div><div>Dear Fabian,<br></div>you may solve the issue using a templated filter. The itk::ImageToImageFilter is templated over its input and output image types, which, at the same time, are templated over their pixel type and dimension [1].<br>
<br></div>Thus, if you define your own filter templated over its input/output image types (and ideally, inheriting itk's ImageToImageFilter) you'd be able to specify the type at execution time, when you read your 2D or 3D (even ND) input.<br>
<br></div>In order to know the pixel type and dimensions of an image at execution time, you can get some inspiration from ITK's ReadUnknownImageType example [2].<br><br></div>HTH,<br>JON HAITZ<br><br><div><div>[1] <a href="http://www.itk.org/Doxygen/html/classitk_1_1Image.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1Image.html</a><br>
<div><div><div><div class="gmail_extra">[2] <a href="http://www.itk.org/Wiki/ITK/Examples/IO/ReadUnknownImageType" target="_blank">http://www.itk.org/Wiki/ITK/Examples/IO/ReadUnknownImageType</a><br><br><br><div class="gmail_quote">
<div><div>On 3 March 2014 19:32, Fabian Torres <span dir="ltr"><<a href="mailto:fabian.trobles@gmail.com" target="_blank">fabian.trobles@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr"><div>Hi all.</div><div><br></div><div>I´m making a filter in ITK for surface enhancement. This filter is an itkImageToImageFilter.</div>
<div><br></div><div>Sometimes I will use this filter with 2D images an sometimes with 3D images. The thing is that inside this filter I have to use some other itk components and I need to specify the number of dimensions I´m using. So this is a problem since itk does not let me use variables to specify this.</div>
<div><br></div><div>I´m using the next for 3D:</div><div><br></div><div>typedef itk::Vector< PixelType, 3 > VectorPixelType;</div><div>typedef itk::Vector< VectorPixelType, 3 > MatrixPixelType;</div><div>typedef itk::SymmetricSecondRankTensor< PixelType, 3 > TensorPixelType; </div>
<div><br></div><div>typedef itk::Image< TensorPixelType, 3 > TensorImageType;<br></div><div><br></div><div>but I also need to work with 2D and use the same filter.</div><div><br></div><div>Is there a way to know the number of dimensions of the filter input image, and declare the typedefs using this value? </div>
<span><font color="#888888">
<div><br></div><br clear="all"><div><br></div>-- <br>Fabián Torres Robles<br>Maestria en Ciencias en Ingeniería Electrónica<br>Ingeniería en Sistemas Electrónicos<br>tel. 58081280, 0445534661338<br>e-mail <a href="mailto:fabian.trobles@gmail.com" target="_blank">fabian.trobles@gmail.com</a>, <a href="mailto:dae.wong@gmail.com" target="_blank">dae.wong@gmail.com</a> <div style="line-height:130%;text-align:left;font-size:10px;overflow:hidden;margin-left:0px;word-wrap:break-word;margin-top:0px;padding:0px">
</div><div style="line-height:130%;text-align:left;font-size:10px;overflow:hidden;margin-left:0px;word-wrap:break-word;margin-top:0px;padding:0px"></div>
</font></span></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><br></div></div></div></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Fabián Torres Robles<br>Maestria en Ciencias en Ingeniería Electrónica<br>Ingeniería en Sistemas Electrónicos<br>tel. 58081280, 0445534661338<br>e-mail <a href="mailto:fabian.trobles@gmail.com" target="_blank">fabian.trobles@gmail.com</a>, <a href="mailto:dae.wong@gmail.com" target="_blank">dae.wong@gmail.com</a> <div style="line-height:130%;text-align:left;font-size:10px;overflow:hidden;margin-left:0px;word-wrap:break-word;margin-top:0px;padding:0px">
</div><div style="line-height:130%;text-align:left;font-size:10px;overflow:hidden;margin-left:0px;word-wrap:break-word;margin-top:0px;padding:0px"></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Fabián Torres Robles<br>Maestria en Ciencias en Ingeniería Electrónica<br>Ingeniería en Sistemas Electrónicos<br>tel. 58081280, 0445534661338<br>e-mail <a href="mailto:fabian.trobles@gmail.com" target="_blank">fabian.trobles@gmail.com</a>, <a href="mailto:dae.wong@gmail.com" target="_blank">dae.wong@gmail.com</a> <div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">
</div>
</div></div>