[IGSTK-Users] vtkImageData in fltk

Simon Hahne Simon.Hahne at gmx.de
Thu May 3 12:04:59 EDT 2012


Dear all!

I try to visualize a CTImage in fltk and skip through
the images via sliders. I read it in ITK and put it into a vtkImageData. But I get the error: 
vtkOpenGLImageActor (0x8ba93e0): This filter requires unsigned char scalars as input.
What can I do to avoid this error?

With best regards

Simon


Here you get some code snippets from me:

void vtkFlGUI::cb_sliderAxial_i(Fl_Slider* o, void*) {
	viewer->SetSliceOrientationToXY();
	viewer->SetSlice(o->value());
	vtkWindow->redraw();
	Fl::check();
}
void vtkFlGUI::cb_sliderAxial(Fl_Slider* o, void* v) {
	((vtkFlGUI*)(o->parent()->user_data()))->cb_sliderAxial_i(o,v);
}


vtkFlGUI::vtkFlGUI() {
	{ MainWindow = new Fl_Double_Window(515, 500, "GUI");
	MainWindow->user_data((void*)(this));
	{ vtkWindow = new vtkFlRenderWindowInteractor (5, 5, 505, 330);
	vtkWindow->box(FL_PLASTIC_UP_FRAME);
	vtkWindow->color(FL_BLACK);
	vtkWindow->selection_color(FL_GRAY0);
	vtkWindow->labeltype(FL_NORMAL_LABEL);
	vtkWindow->labelfont(0);
	vtkWindow->labelsize(14);
	vtkWindow->labelcolor(FL_FOREGROUND_COLOR);
	vtkWindow->align(Fl_Align(FL_ALIGN_BOTTOM));
	vtkWindow->when(FL_WHEN_RELEASE);
	} // vtkFlRenderWindowInteractor VtkWindow
	{ Fl_Button* o = new Fl_Button(421, 345, 90, 25, "Quit");
	o->callback((Fl_Callback*)cb_Quit);
	} // Fl_Button* o
	{ Fl_Slider *sliderAxial = new Fl_Slider(30, 370, 335, 20, "Axial");
	sliderAxial->type(5);
	sliderAxial->labelsize(18);
	sliderAxial->maximum(200);
	sliderAxial->step(1);
	sliderAxial->callback((Fl_Callback*)cb_sliderAxial);
	} // Fl_Slider* sliderAxial
	{ Fl_Slider *sliderCoronal = new Fl_Slider(30, 410, 335, 20, "Coronal");
	sliderCoronal->type(5);
	sliderCoronal->labelsize(18);
	sliderCoronal->maximum(512);
	sliderCoronal->step(1);
	sliderCoronal->callback((Fl_Callback*)cb_sliderCoronal);
	} // Fl_Slider* sliderCoronal
	{ Fl_Slider *sliderSagittal = new Fl_Slider(30, 450, 335, 20, "Sagittal");
	sliderSagittal->type(5);
	sliderSagittal->labelsize(18);
	sliderSagittal->maximum(512);
	sliderSagittal->step(1);
	sliderSagittal->callback((Fl_Callback*)cb_sliderSagittal);
	} // Fl_Slider* sliderSagittal
	MainWindow->end();
	} // Fl_Double_Window* MainWindow
	this->viewer = vtkSmartPointer<vtkImageViewer2>::New();
	viewer->SetupInteractor(vtkWindow);
	viewer->SetInput(imageData);
}


void vtkFlGUI::Show() {
	this->MainWindow->show();
	vtkWindow->show();
	vtkWindow->Initialize();
}

-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a



More information about the IGSTK-Users mailing list