Hello!
Yes, I keep coming with these standard problems. :( Now that my plugin
compiles, I get the above error message (or sometimes a "... is not a
valid QT plugin").
I have read about having to add these TypeRevisionMacro calls, but that
did not help in my case. I attached both .h and .cxx files.
What am I missing now?
Best regards,
Christian
#include "vtkObjectFactory.h"
#include "vtkITKSampleImageFilter.h"
#include "vtkITKImageBox.h"
///include your desired filter(s) here / replace ClassPrefix
#include "itkFlipImageFilter.h"
//implement all necessary ImageType Detection funcionality
//macro is defined in vtkITKImageBox.h
vtkITKFilter_CXX_Macro(vtkITKSampleImageFilter);
vtkCxxRevisionMacro(vtkITKSampleImageFilter, "$Revision$");
vtkStandardNewMacro(vtkITKSampleImageFilter);
//Constructor
vtkITKSampleImageFilter::vtkITKSampleImageFilter()
{
}
/**
* YOU ONLY HAVE TO CHANGE THIS FUNCTION TO GET YOUR ITK FILTER WORKING.
* BE SURE TO SET vtkResultImage CORRECTLY AS IN THE LAST TWO LINES
* OF THIS EXAMPLE. ImageType WILL BE SOMETHING LIKE
* itk::image< itk::Vector< unsigned char, 3>, 2 > DEPENDING ON YOUR VTK INPUT.
*/
template <typename ImageType>
void vtkITKSampleImageFilter::
ApplyFilter(vtkImageData* vtkInput)
{
vtkITKImageBox<ImageType> *magicBox = new vtkITKImageBox<ImageType>( vtkInput );
ImageType* itkImage = magicBox->getITKFromVTKImage();
/// your filtering here
typedef itk::FlipImageFilter< ImageType > FilterType;
typename FilterType::Pointer filter = FilterType::New();
typedef typename FilterType::FlipAxesArrayType FlipAxesArrayType;
FlipAxesArrayType flipArray;
flipArray[0] = 0;
flipArray[1] = 1;
filter->SetFlipAxes( flipArray );
filter->SetInput( itkImage );
//set result ITK image into xtkBox, SimpleExecute
//will pass vtkResultImage onto the output port
//which we get out of our xtkBox
magicBox->setITKImage( filter->GetOutput() );
vtkResultImage = magicBox->getVTKFromITKImage();
}
/**
* DO NOT TOUCH - WILL PROBABLY BE INCLUDED INTO CXX_MACRO ANYWAY.
* This is called by vtkSimpleImageToImageFilter and should not be touched.
*/
void vtkITKSampleImageFilter::SimpleExecute(vtkImageData* input, vtkImageData* output)
{
if (input==NULL) {
vtkErrorMacro(<<"Bad Input to vtkITKSampleImageFilter");
return;
}
try {
StartTypeGeneration( input );
output->DeepCopy ( vtkResultImage );
} catch(...) {
//something is not right
vtkErrorMacro(<<"vtkITKSampleImageFilter: ShallowCopy failed...");
}
}
#ifndef IVTK_SAMPLE_FILTER
#define IVTK_SAMPLE_FILTER
#include "vtkSimpleImageToImageFilter.h"
class VTK_IMAGING_EXPORT vtkITKSampleImageFilter : public vtkSimpleImageToImageFilter {
public:
static vtkITKSampleImageFilter* New();
vtkTypeRevisionMacro( vtkITKSampleImageFilter, vtkSimpleImageToImageFilter );
protected:
vtkITKSampleImageFilter();
vtkITKSampleImageFilter(const vtkITKSampleImageFilter&) {};
void operator=(const vtkITKSampleImageFilter&) {};
//override from vtkImageToImageFilter
virtual void SimpleExecute(vtkImageData* inp, vtkImageData* out);
//BTX
vtkImageData* vtkResultImage;
//ETX
/// these function are needed in ALL vtkITK Filters
virtual void StartTypeGeneration(vtkImageData*);
//BTX
template<unsigned int DIM>
//ETX
void FinalizeImageType(vtkImageData* vtkInput);
//BTX
template<unsigned int DIM, unsigned int COMP>
//ETX
void CreateType(vtkImageData* vtkInput);
/// custom Filter function ///
//BTX
template <typename ImageType>
//ETX
void ApplyFilter(vtkImageData* vtkInput);
};
#endif
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview