[vtkusers] source-imagetoimagefilter

yala kaluma yala_aiiii at hotmail.com
Mon Mar 21 19:21:59 EST 2005


I am trying to play with filters available in the VTKlibrary as i am 
starting off.
It seems like it is not possible to use a source as an input to an image to 
image filter. Why is that? Should I introduce something else between the 
source and the image to image filter?

Here is the code i am having problem with...

Thank u very much!!!
Yala

#include "vtkPNGReader.h"
#include "vtkImageCast.h"
#include "vtkImageThreshold.h"
#include "vtkImageEuclideanDistance.h"
#include "vtkImageViewer.h"
#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"

int main(int argc,char *argv[])
{
vtkConeSource *cone = vtkConeSource::New();
cone->SetHeight( 3.0 );
cone->SetRadius( 1.0 );
cone->SetResolution( 10 );

vtkImageCast *cast=vtkImageCast::New();
cast->SetOutputScalarTypeToShort();
cast->SetInput(cone->GetOutput());

vtkImageThreshold *thresh=vtkImageThreshold::New();
thresh->SetInput(cast->GetOutput());
thresh->ThresholdByUpper(2000.0);
thresh->SetInValue(0);
thresh->SetOutValue(200);
thresh->ReleaseDataFlagOff();

vtkImageEuclideanDistance *dist=vtkImageEuclideanDistance::New();
dist->SetInput(thresh->GetOutput());
dist->SetAlgorithmToSaito();

vtkImageViewer *viewer=vtkImageViewer::New();
viewer->SetInput(dist->GetOutput());
viewer->SetColorWindow(117);
viewer->SetColorLevel(43);

viewer->Render();

//source [file join [file dirname [info script]] WindowLevelInterface.tcl]

cone->Delete();
cast->Delete();
thresh->Delete();
dist->Delete();
viewer->Delete();
coneMapper->Delete();

return 0;
}

_________________________________________________________________





More information about the vtkusers mailing list