Hi Miri,
you want to pass a 2D image to a function that expects a 3D image. This will
not work.
You can use e.g. the itk::TileImageFilter to create a 3D image from the 2D
one, so you can pass it to the function.
To use the TileImageFilter you will have to create an itk::FixedArray with
the values (1, 1, 0), and then to call tileImageFilter->SetInputImage(0,
your2DImage).
Best,
Miklos
On Fri, Oct 28, 2011 at 6:54 PM, Miri Trope <[email protected]> wrote:
> Thank you for your answer.
> I took your advise and compiled:
>
> void AddFilter(itk::Image <unsigned char, 3>* image, mitk::Image::Pointer
> outputImage)
> {...}
>
> but I got some errors like this one:
> ..\..\..\..\MITK_myProjects\Modules\MyModuleLib\myFilter.cpp(78) : error
> C2664: 'AddFilter' : cannot convert parameter 1 from
> 'itk::Image<TPixel,VImageDimension> *' to
> 'itk::Image<TPixel,VImageDimension> *'
> 1> with
> 1> [
> 1> TPixel=int,
> 1> VImageDimension=2
> 1> ]
> 1> and
> 1> [
> 1> TPixel=unsigned char,
> 1> VImageDimension=3
> 1> ]
> 1> Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
>
>
>
>
>
> On Fri, Oct 28, 2011 at 1:08 PM, Goch, Caspar Jonas <
> [email protected]> wrote:
>
>> Hi Miri,****
>>
>> ** **
>>
>> I am not entirely sure, where you are trying to switch to a specific
>> datatype, but if you want to use it with a specific one you enter the
>> datatype, just like in itk::Image< float, 3 > for a three dimensional itk
>> Image using floats. If you are asking about defining the function for a
>> specific datatype, you can just get rid of the parameter and define it like
>> ****
>>
>> ** **
>>
>> template< unsigned int VImageDimension>
>> void AddFilter(itk::Image<float, VImageDimension>* image,
>> mitk::Image::Pointer outputImage)****
>>
>> ** **
>>
>> or even get rid of templating altogether****
>>
>> ** **
>>
>> void AddFilter(itk::Image<float, 3>* image, mitk::Image::Pointer
>> outputImage)****
>>
>> ** **
>>
>> ** **
>>
>> In any case, you might want to read further into the usage of templates as
>> for example here http://www.cplusplus.com/doc/tutorial/templates/ .****
>>
>> ** **
>>
>> Regards,****
>>
>> Caspar****
>>
>> ** **
>>
>> *Von:* Miri Trope [mailto:[email protected]]
>> *Gesendet:* Freitag, 28. Oktober 2011 12:24
>> *An:* mitk-users
>> *Betreff:* [mitk-users] Changing image type****
>>
>> ** **
>>
>> Hi All,
>>
>> I have some questions:
>>
>> 1. The example of template on web (awesomeFilter) gets the image type as
>> is by typename
>>
>> templaye<*typename TPixel*, unsigned int VImageDimension>
>> void AddFilter(itk::Image<*TPixel*, VImageDimension>* image,
>> mitk::Image::Pointer outputImage)
>> {...}
>> ,thus if I want to change the image type, I need to use the filter:
>> itk::castingFilter. How can I get the image as any type that *I want* and
>> avoid the casting afterwards? My intuition is telling me that it should be
>> something like that:
>> typename<*float TPixel*, unsigned int VImageDimension>
>> but that returns errors...
>>
>> 2. It's really necessary to add the cpp files in the cmake file:
>> moduls\MyModuleLib\files.cmake like that:
>>
>> set (CPP_FILES
>> myCppFile1.cpp
>> myCppFile2.cpp)
>> ...
>> I think that when I don't add that, it doesn't matter the result.
>>
>>
>> Thanks!****
>>
>
>
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> mitk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
>
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users