[Insight-users] ITK filter dimensions.

Fabian Torres dae.wong at gmail.com
Mon Mar 3 16:28:29 EST 2014


> Thanks all
>
> For the quick response I manage to do what I wanted using a templated
> filter just like Jon said.
>
> What I do was
>
> typedef typename InputImageType::PixelType PixelType;
> typedef itk::Vector< PixelType,
> itk::GetImageDimension<InputImageType>::ImageDimension > VectorPixelType;
> typedef itk::Vector< VectorPixelType,
>  itk::GetImageDimension<InputImageType>::ImageDimension > MatrixPixelType;
> typedef itk::SymmetricSecondRankTensor< PixelType,
>  itk::GetImageDimension<InputImageType>::ImageDimension > TensorPixelType;
>
> typedef itk::Image< TensorPixelType,
>  itk::GetImageDimension<InputImageType>::ImageDimension > TensorImageType;
>
> and it worked just Fine.
>
> Thanks again
>
>
> On Mon, Mar 3, 2014 at 12:45 PM, Jon Haitz Legarreta <
> jhlegarreta at vicomtech.org> wrote:
>
>> Dear Fabian,
>> 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].
>>
>> 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.
>>
>> 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].
>>
>> HTH,
>> JON HAITZ
>>
>> [1] http://www.itk.org/Doxygen/html/classitk_1_1Image.html
>> [2] http://www.itk.org/Wiki/ITK/Examples/IO/ReadUnknownImageType
>>
>>
>> On 3 March 2014 19:32, Fabian Torres <fabian.trobles at gmail.com> wrote:
>>
>>> Hi all.
>>>
>>> I´m making a filter in ITK for surface enhancement. This filter is an
>>> itkImageToImageFilter.
>>>
>>> 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.
>>>
>>> I´m using the next for 3D:
>>>
>>> typedef itk::Vector< PixelType, 3 > VectorPixelType;
>>> typedef itk::Vector< VectorPixelType,  3 > MatrixPixelType;
>>> typedef itk::SymmetricSecondRankTensor< PixelType,  3 > TensorPixelType;
>>>
>>> typedef itk::Image< TensorPixelType,  3 > TensorImageType;
>>>
>>> but I also need to work with 2D and use the same filter.
>>>
>>> Is there a way to know the number of dimensions of the filter input
>>> image, and declare the typedefs using this value?
>>>
>>>
>>>
>>> --
>>> Fabián Torres Robles
>>> Maestria en Ciencias en Ingeniería Electrónica
>>> Ingeniería en Sistemas Electrónicos
>>> tel. 58081280, 0445534661338
>>> e-mail fabian.trobles at gmail.com, dae.wong at gmail.com
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.php
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>
>
>
> --
> Fabián Torres Robles
> Maestria en Ciencias en Ingeniería Electrónica
> Ingeniería en Sistemas Electrónicos
> tel. 58081280, 0445534661338
> e-mail fabian.trobles at gmail.com, dae.wong at gmail.com
>



-- 
Fabián Torres Robles
Maestria en Ciencias en Ingeniería Electrónica
Ingeniería en Sistemas Electrónicos
tel. 58081280, 0445534661338
e-mail fabian.trobles at gmail.com, dae.wong at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140303/fa4ca3b7/attachment.html>


More information about the Insight-users mailing list