It seems like your filter is of type mitk::ImageSource. If you call
this->GetOutput() you will get an mitk::Image, which is why you get the
initialization error. I don't know what you own filter is doing but if you want
to get an image from your surface I would recommend the following code:
mitk::SurfaceToImageFilter::Pointer s2iFilter
= mitk::SurfaceToImageFilter::New();
//Just optional
s2iFilter->MakeOutputBinaryOn();
s2iFilter->SetInput(surface);
s2iFilter->SetImage(image);
s2iFilter->Update();
mitk::Image::Pointer image
= s2iFilter->GetOutput();
Regards
Andreas
On 14.11.2011, at 11:05, Miri Trope wrote:
Hi Andreas,
Thank you for your answer.
I converted my vtkPolyData into a surface like this:
mitk::Surface::Pointer surface mitk::Surface::New();
surface->SetVtkPolyData(myVtkPolyData);
surface->Update();
Now I'm dealing with an error in my GenerateData function because of this
command:
mitk::Surface::Pointer surface = this->GetOutput();
The error:
"error c2440: ''initializing" : cannot convert from
'mitk::ImageSource::OutputImageType *' to 'mitk::Surface*'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style
cast or function-style cast"
On Mon, Nov 14, 2011 at 7:45 AM, Miri Trope
<[email protected]<mailto:[email protected]>> wrote:
Hi again,
I'm trying to process an MRI image. my next task is to extract the head's skin.
In order to do that, I've manipulated that image with some vtk's filters and
now got an vtkPolyData.
I'd like to view that, it's my result and I don't know in which way should I
represent my output image on mitk.
I tried some methods to do so, without a big success.
I tried to convert my data to stencil, but the image looks too spacing.
anyway, I think that the conversion to stencil is unnecessary, because it just
extend the conversions.
what is the way to do so, is it with a conversion to a surface?
Please help me, I'm kinda lost...
On Sat, Nov 12, 2011 at 7:01 PM, Miri Trope
<[email protected]<mailto:[email protected]>> wrote:
Hi all,
I'd like to view my vtkPolyData on mitk by a pointer to mitk::Image.
I have a vtkPolyData image and would like to convert it to an mitk image with a
pointer to outputImage which defined:
mitk::Image::Pointer outputImage = this->GetOutput();
I've already done:
vtkPolyData* vtkPol = vtkPolyData::New();
mitk::Surface::Pointer surface = mitk::Surface::New();
surface->SetVtkPolyData(vtkPol,0);
surface->Update();
mitk::SurfacToImageFilter* surface2Mitk = mitk::SufaceToImageFilter::New();
surface2Mitk->SetInput(surface);
surface2Mitk->Update();
What should I do in order to get that surface by outputImage?
* I'd like to mention again that the conversion to a surface isn't really
necessary for me. I just want to view my result from some filters that returned
a vtkPolData by an mitk image.
* Sascha offered a way to do that with a DataStorage/node, but I don't know how
to get that Data into my pointer:
mitk::Image::Pointer outputImage = this->GetOutput(0);
Any way to do that will be warmly welcome.
On Fri, Nov 11, 2011 at 7:21 PM, Fetzer, Andreas
<[email protected]<mailto:[email protected]>> wrote:
Hi Miri,
if you want to create and image out of a surface you can use the
mitkSurfaceToImageFilter which converts surface data into pixel data.
Regards
Andreas#
On 11.11.2011, at 17:32, Miri Trope wrote:
Hi Miklos,
My Exception is:
"..\..\..\CMakeExternals\Source\ITK\Code\Common\itkProcessObject.cxx:981:
itk::ERROR: myModule:(18F41FB8): At least 1 inputs are required but only 0 are
specified"
In the output from Debug of visual studio:
ERROR: In //\//\CMakeExternals\Source\VTK\Rendering\vtkPolyDataMapper.cxx, line
60 vtkPaintPolyDataMapper (18F4D168) : Mapper has no input
ERROR: In //\//\CMakeExternals\Source\VTK\Rendering\vtkOpenGLTexture.cxx, line
196 vtkOpenGLTexture (188432F0): No scalar value found for texture input!
what might be the reason for that run time error?
* another conversion question which can save my time: I have a pointer to a
mitk::surface data and would like to view that surface on mitk. I might need to
convert that surface to an mitk::image. how should I do this?
Thanks,
Miri
On Thu, Nov 10, 2011 at 11:48 AM, Miklos Espak
<[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
wrote:
Hi Miri,
in your original e-mail there was this line:
itk::Image < ImageType > ::Pointer itkImage_1;
now there is these lines:
typedef unsigned short InputPixelType;
typedef itk::Image < InputPixelType, 3 > InputImageType;
itk::Image< InputPixelType, 3>::Pointer itkImage_1;
These are different. In the first case you have a 2D image, in the second case
3D.
If the exception is thrown by the Update() function, it means that it is thrown
by the filter's GenerateData function (or from its call chain). So, I still
think that there is a type mismatch during the cast.
I suggest to put the Update call into an exception handler, catch
itk::ExceptionObject, and print its message. (As I remember, it is the what()
function that tells it to you.)
Best,
Miklos
On Thu, Nov 10, 2011 at 9:35 AM, Miri Trope
<[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
wrote:
Thank you for tying to help me.
Casting to the exact input image type is what I tryied to implement (after
checking it with the debugger).
Actually, I ran it again with these commands, but received the mentioned error.
typedef unsigned short InputPixelType;
typedef itk::Image < InputPixelType, 3 > InputImageType;
itk::Image< InputPixelType, 3>::Pointer itkImage_1;
- I'd like to mention again that the error accepted in the following command:
myModulePointer->Update(); // a command at the file: MyPlugInView.cpp
- My application was generated by the CTK's generator and I just changed that
application in order to get a multiple number of input images (instead of one
input image, as the generator implemented).
On Wed, Nov 9, 2011 at 10:42 PM, Miklos Espak
<[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
wrote:
Hi,
are these 2D images?
The itk::Image template class expects two parameters, the pixel type and the
dimension. For the dimension there is a default value that is 2. That's why
your code does not cause compile error.
However, you must cast the mitk::Image into exactly the same kind of
itk::Image. If you have a 3D mitk::Image, you cannot cast it into a 2D itk
image. Even the pixel types must be the same.
In your code:
itk::Image < ImageType > ::Pointer itkImage_1;
The ImageType name is rather misleading, since a primitive type should be
there, typically.
Best,
Miklos
On Wed, Nov 9, 2011 at 8:41 PM, Miri Trope
<[email protected]<mailto:[email protected]><mailto:[email protected]<mailto:[email protected]>>>
wrote:
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]<mailto:[email protected]><mailto:[email protected]<mailto:[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<http://p.sf.net/sfu/rsa-sfdev2dev1_______________________________________________%0Amitk-users>
mailing list
[email protected]<mailto:[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