[IGSTK-Users] bad visualization of Dicom

Manuel Ricardo Galindo Moreno mrgalindo at puj.edu.co
Thu Apr 27 14:21:42 EDT 2006


Hello

I am giving my firsts steps into igstk with my own program. It only gets a dicom directory and visualize a slice.

I think i have a problem using igstk::view2d because it does not show me the image right.

the testing dicom set i am using is the E000192(CT), found in the testing directory of IGSTK. It is the only dicom set that shows me anything, with a dicom set of my own(CT) i can't make it show something.

Thanks for the help, my code is:


#include <iostream>
#include <string>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_File_Input.H>
#include <FL/Fl_Output.H>
#include <igstkView2D.h>
#include <igstkCTImageReader.h>
#include <igstkCTImageSpatialObjectRepresentation.h> 

void open (char path[])
{
// Generates a VTK Window
	Fl_Window *VTKwin = new Fl_Window(0,0,550,550);
	VTKwin->label("CT Image");
	VTKwin->begin();

// Generates a pointer to a file reader and asigns it the path name of the DICOM directory
	typedef igstk::CTImageReader ReaderType;
	ReaderType::Pointer reader = ReaderType::New();
	ReaderType::DirectoryNameType directoryName = path;
	reader->RequestSetDirectory( directoryName );
	reader->RequestReadImage();

// Generates a pointer to the object which contains de CT image and saves it
	typedef igstk::CTImageSpatialObject CTImageType;
	typedef CTImageType::ConstPointer CTImagePointer;
	CTImagePointer ctImage = reader->GetOutput();

// Generates an Object representation for the vtk visualization
	typedef igstk::CTImageSpatialObjectRepresentation RepresentationType;
	RepresentationType::Pointer representation = RepresentationType::New();
	representation->RequestSetImageSpatialObject( ctImage );
	representation->RequestSetOrientation( RepresentationType::Axial );
	representation->RequestSetSliceNumber( 2 );

// Generates a 2D space where the CT image will be displayed
	typedef igstk::View2D  View2DType;
	View2DType *view2D = new View2DType(20,20,512,512,"2D View");
	view2D->RequestResetCamera();
	view2D->RequestEnableInteractions();
	view2D->RequestAddObject( representation );

	VTKwin->end();
	VTKwin->show();

	return;
}

// Callback Function for saving the pathname. Calls the function that opens the CTimage
void get_path(Fl_Widget* o , void* v)
{
	const char *u;
	char path[256];
	Fl_File_Input *t=(Fl_File_Input*)o;
	u=t->value();
	strcpy(path,u);
	open(path);
	return;
}

int main(int argc, char **argv) 
{
// Configures the Global Window
	Fl_Window *window = new Fl_Window(0,0,650,60);
	window->label("Open");
	window->begin();

// Generates the input object to save de pathname
	Fl_File_Input *path=new Fl_File_Input(130,10,500,40,"Path to DICOM Dir");
	path->when(FL_WHEN_ENTER_KEY);
	path->callback(get_path);

	window->end();
	window->show(argc, argv);

return Fl::run();
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20060427/42d81387/attachment-0001.html>


More information about the IGSTK-Users mailing list