Hi Casper,
sorry if It sounds daft question, but I'm a new mitk's user.
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 error
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 inputImage to
my Function as I did (with a const pointer) and then, how can I manipulate
my filters on the that image?
2) How can I send to myFunc a 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);
}
and how should myFunction signature look like (the const pointer is a very
sensitive issue for me :-), how can I avoid from writing him at the first
place)?
A lot of thanks,
Miri
On Mon, Nov 7, 2011 at 2:50 PM, Miri Trope <[email protected]> wrote:
> Hi Casper, sorry if It sounds daft question, but I'm a mitk's new user.
>
> 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 generat
>
> void myFunction
>
> So, I have two questions:
> 1) because the function getInput(0) can return only constPointer (I got
> errors if I didn't manipulate that in this way) I must sent the image to my
> Function as I did and then, how can I manipulate my filter How am I using
> mitk's image which has a const pointer
>
>
>
>
>
> On Mon, Nov 7, 2011 at 2:23 PM, Goch, Caspar Jonas <
> [email protected]> wrote:
>
>> Hi Miri,****
>>
>> ** **
>>
>> the AccessByITK macros are designed for one generic image class only, as
>> the need to instantiate (number of data types)^(number of images) different
>> classes at compile time would lead to extremely long compiles. If you
>> really do need a completely generic way you would need to implement this
>> yourself, but if you either know the data type of your images directly, or
>> in relation to the one generic one (as in, e.g. the same) you might want to
>> take a look at mitk::CastToItkImage (see
>> http://docs.mitk.org/nightly-qt4/group__Adaptor.html the detailed
>> description for more info). ****
>>
>> ** **
>>
>> So I would suggest either handing your function a vector of image
>> pointers, or just storing and accessing the images using class members via
>> CastToItkImage .****
>>
>> ** **
>>
>> Regards,****
>>
>> Caspar****
>>
>> ** **
>>
>> *Von:* Miri Trope [mailto:[email protected]]
>> *Gesendet:* Sonntag, 6. November 2011 09:03
>> *An:* mitk-users
>> *Betreff:* [mitk-users] Insert multiple input images to a method in my
>> module****
>>
>> ** **
>>
>> Hi all,
>>
>> How should I insert/manage multiple input images to a method in my module?
>> Until now, I inserted only *one* input image by
>> accessIntegralPixelTypeByItk and simply insert that image in my method like
>> this:
>>
>> //=======================
>>
>> void myFilter::GenerateData()
>> {
>> mitk::Image::ConstPointer image = this->GetInput(0);
>> try
>> {
>> AccessInterslPixelTypeByItk_n(image, myMethod, (some_Inputs...))
>> }
>> }
>>
>> //=======================
>>
>> template<typename TPixel, unsigned int VImageDimension>
>> void myMethod (itk::Image<TPixel, VImageDimension>* image, some_Inputs)
>> {...}
>>
>> //========================
>>
>> Now, I'd like to insert *multiple images *(actually, four images) to my
>> method.
>> How should I do this?
>>
>> Thanks.****
>>
>
>
------------------------------------------------------------------------------
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