Hi Klaus,

your suggestion has helped me to move on, but not till the end... forgive
me if my question looks daft, it's because I'm a new mitk's user.


So let's say that I have two functions. One of them generates data (input
and output images) and the other gets that data and manipulates some
filters on them like this:

void  myClass::GenerateData()

{

Mitk::Image::ConstPointer inputImage = this->GetOutput(0);

Mitk::Image::Pointer outputImage = this->GetOutput();

MyFunction( inputImage, m_inputVal1, outputImage);

}


void myFunction(const mitk::Image* inputMitkImage, int val1,
mitk::Image::Pointer outputImage)

{

vtkImageData* vtkImage = mitkImage->GetVtkImage(); // this returns errors
regarding the const pointer //which can’t change the image

}

So, I have two questions:
1) Because the function getInput(0) can return only a constPointer- (I get
errors if I don't manipulate in this way) so I must send the inputMitkImage
to myFunction as I did above (with a const pointer) and then, how can I
manipulate my filters on that image? do you have any idea how can get as an
input a pointer (it seems that getInput() can only return a const pointer
and returns errors if don't)


2) How can I send to myFunc multiple number of images?

Is my intuition right that it should be something like this?

void  myClass::GenerateData()

{

Mitk::Image::ConstPointer inputImage_1 = this->GetOutput(0); //to insert
the first selected image

Mitk::Image::ConstPointer inputImage_2 = this->GetOutput(1); //to insert
the second selected image

Mitk::Image::ConstPointer inputImage_3 = this->GetOutput(2); //to insert
the third selected image

Mitk::Image::Pointer outputImage = this->GetOutput();

MyFunction( inputImage_1, inputImage_2, inputImage_3, m_inputVal1,
outputImage);

}



A lot of thanks,

Miri




On Mon, Nov 7, 2011 at 2:36 AM, Klaus Drechsler <[email protected]> wrote:

>  Hi,
>
> I am still not 100% sure, if I understand your problem. If you have an
> mitk image, you can easily get the vtkImageData by calling
>
> vtkImageData* vtkImage = mitkImage->GetVtkImageData();
>
> Now you have the vtkImage and can set it as input to your vtk filters.
> Is this not what you want?
>
> There is not really a need for an "AccessByVtk" method as no explicit
> conversion/casting is needed.
>
> Why can you not just implement a normal method and pass the vtk image as
> argument like this:
>
>
> MyVtkFilterMethod(mitk::Image *mitkImage){
>     vtkImageData* vtkImage = mitkImage->GetVtkImageData();
>     ...
>     vtkFilter->SetInput(vtkImage)
>     ...
> }
>
> Best wishes,
>  Klaus
>
> Am 05.11.2011 09:07, schrieb Miri Trope:
>
> Thank you for you answer,
>
> I followed your suggestion and the instructions as described 
> here<http://docs.mitk.org/nightly-qt4/Step06Page.html>and found that 
> AccessByItk gets MyAccessMethod as well (GetVtkImageData
> doesn't):
>
> template<TPixel, VImageDimension>
> MyAccessMethod(itk::Image<TPixel, VImageDimension>* itkImage)
> {
> ...
> }
>
>  AccessByItk 
> <http://docs.mitk.org/nightly-qt4/group__Adaptor.html#ga67ad28ba2fe729db2f6e195dcf49c070>(mitkImage,
>  MyAccessMethod)
>
>  my question is how should I do* the same- with MyAccessMethod mentioned*but 
> instead with Itk's access with vtk's access.
>
> I'm asking that because I'd like to use vtk's filters on vtkImageData
> while first image is mitk's image. So If I'm getting an mitk image first
> and want to get vtkImage last (for vtk's filters) like that:
> mitk image-> (the conversion which I'm seeking) -> vtk image->using of
> vtk's filters- How should I convert from mitk image (which I'm getting) to
> vtkImageData* vtkImage.
>
> Hope that now I was clearer,
> Thank again.
>
>
> On Fri, Nov 4, 2011 at 11:23 PM, Klaus Drechsler <[email protected]>wrote:
>
>>  Hi,
>>
>> maybe I did not understand your question correctly, but is
>>
>> vtkImageData * mitk::Image::GetVtkImageData()
>>
>> not what you want?
>>
>> Best wishes,
>>  Klaus
>>
>> Am 04.11.2011 12:33, schrieb Miri Trope:
>>
>>  Hi,
>>
>> please help me ...
>> I hope that my question is clear, please don't hesitate to ask if it
>> doesn't.
>>
>> On Thu, Nov 3, 2011 at 8:04 AM, Miri Trope <[email protected]> wrote:
>>
>>> as a continue to section two- regarding the conversion of itk to vtk,
>>> the error is:
>>>
>>> c:\mitk_myprojects\modules\mymodulelib\itkImageToVTKImageFilter.txx(106)
>>> : error C2244: 'itk::VTKImageToImageFilter<TOutputImage>::GetImporter' :
>>> unable to match function definition to an existing declaration
>>> 1>
>>> c:\mitk_myprojects\modules\mymodulelib\itkVTKImageToImageFilter.h(80) : see
>>> declaration of 'itk::VTKImageToImageFilter<TOutputImage>::GetImporter'
>>> 1>        definition
>>> 1>        'const VTKImageToImageFilter<TOutputImage>::Superclass
>>> *itk::VTKImageToImageFilter<TOutputImage>::GetImporter(void) const'
>>> 1>        existing declarations
>>> 1>        'itk::VTKImageImport<TOutputImage>
>>> *itk::VTKImageToImageFilter<TOutputImage>::GetImporter(void) const'
>>>
>>>
>>> please help me to figure this out or suggest another way to do this...
>>>
>>>
>>> On Wed, Nov 2, 2011 at 3:57 PM, Miri Trope <[email protected]> wrote:
>>>
>>>> My previous post deserves a new post, so I'll ask again:
>>>>
>>>> I'd like to insert my code that include VTK's filters, but *I don't
>>>> find a way to convert my mitk input image to vtk*.
>>>>
>>>> I've tried to:
>>>> 1. use the method: AccessIntegralPixelTypeByItk and get the image like
>>>> this:
>>>> void myFunc(itk::Image<Tpixel, dimention>*image, mitk::Image::Pointer
>>>> outputImage) and simply use ITK filters.
>>>> Is there a similar way to access mitk image by vtk (like
>>>> AccessIntegralPixelTypeByItk *but to vtk*)
>>>>
>>>> 2. Use AccessIntegralPixelTypeByItk and afterwards convert itk image to
>>>> vtk image.
>>>> I tried to use the filer:
>>>> itkImageToVTKImageFilter which call to itkVTKImageToImageFilter but an
>>>> error returned: error C2244.
>>>>
>>>> Are there better ways to do this?
>>>>
>>>>
>>>> Thanks.
>>>>
>>>
>>>
>>
>>
>>  
>> ------------------------------------------------------------------------------
>> RSA(R) Conference 2012
>> Save $700 by Nov 18
>> Register nowhttp://p.sf.net/sfu/rsa-sfdev2dev1
>>
>>
>>
>> _______________________________________________
>> mitk-users mailing 
>> [email protected]https://lists.sourceforge.net/lists/listinfo/mitk-users
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> RSA(R) Conference 2012
>> Save $700 by Nov 18
>> Register now
>> http://p.sf.net/sfu/rsa-sfdev2dev1
>> _______________________________________________
>> mitk-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mitk-users
>>
>>
>
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> mitk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to