Hi everyone,
I manipulated the ability to select and manipulate four 3D input images
from a known type (all of them have the same type). I mean that the user
has to pick four images on mitk platform and run my module.
But it returns a run-time error which described below. That run time
returned after the command:
myModulePointer->Update();
In addition below is my code, please help me to figure it out. It's just my
first time to manipulate things like that ...
run time error
==========
Unhandled exception at 0x7d4e237e in MyApp.exe: Microsoft C++ exception:
itk::ExceptionObject at memory location 0x00d9b640..
First-chance exception at 0x7d4e237e in MyApp.exe: Microsoft C++ exception:
[rethrow] at memory location 0x00000000..
==========
MyPlugInView.cpp
-----------------
void MyPlugInView::DoImageProcessing()
{
std::vector<mitk::DataNode*> nodes = this->GetDataManagerSelection();
myModule::Pointer myModulePointer = myModule::New();
while(!nodes.empty()) // set the input images to const member pointers of
class MyModule
{
mitk::DataNode* node = nodes.back();
nodes.pop_back();
mitk::BaseData* data = node->GetData();
mitk::Image* image = dynamic_cast<mitk::Image*>( data );
// I did the next assignment for each image by switching an index in
[N=1:numOfImages]
// these assignments really work! each command assigns the input image
to her member pointer
myModulePointer->SetinputImage_N(image);
...
}
myModulePointer->Update();// here I get the run time error
}
MyModule.h
-------------
class MyModuleLib_EXPORT MyModule : public mitk::ImageToImageFilter
{
public:
void MyFunction( mitk::Image::Pointer outputImage );
// pointers to mitk selected input images
mitk::Image::ConstPointer m_inputImage_1;
mitk::Image::ConstPointer m_inputImage_2;
mitk::Image::ConstPointer m_inputImage_3;
mitk::Image::ConstPointer m_inputImage_4;
void GenerateData();
protected:
MyModule();
~MyModule();
};
MyModule.cpp
------------
void MyModule::MyFunction( mitk::Image::Pointer outputImage )
{
itk::Image < ImageType > ::Pointer itkImage_1;
mitk::CastToItkImage(m_inputImage_1, itkImage_1); // in order to get rid
of the const pointer of mitk input image
mitk::CastToMitkImage(itkImage_1, outputImage); // in order to view my
result
}
MyModule::MyModule():
m_inputImage_1(0),m_inputImage_2(0),m_inputImage_3(0),m_inputImage_4(0)
{
this->SetNumberOfInputs(4); // four selected inputImages
}
MyModule::~MyModule()
{
}
void MyModule::GenerateData()
{
mitk::Image::Pointer outputImage = this->GetOutput();
MyFunction( outputImage );
}
------------------------------------------------------------------------------
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