<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.6944.0">
<TITLE>bad visualization of Dicom </TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Hello<BR>
<BR>
I am giving my firsts steps into igstk with my own program. It only gets a dicom directory and visualize a slice.<BR>
<BR>
I think i have a problem using igstk::view2d because it does not show me the image right.<BR>
<BR>
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.<BR>
<BR>
Thanks for the help, my code is:<BR>
<BR>
<BR>
#include <iostream><BR>
#include <string><BR>
#include <FL/Fl.H><BR>
#include <FL/Fl_Window.H><BR>
#include <FL/Fl_Box.H><BR>
#include <FL/Fl_File_Input.H><BR>
#include <FL/Fl_Output.H><BR>
#include <igstkView2D.h><BR>
#include <igstkCTImageReader.h><BR>
#include <igstkCTImageSpatialObjectRepresentation.h><BR>
<BR>
void open (char path[])<BR>
{<BR>
// Generates a VTK Window<BR>
Fl_Window *VTKwin = new Fl_Window(0,0,550,550);<BR>
VTKwin->label("CT Image");<BR>
VTKwin->begin();<BR>
<BR>
// Generates a pointer to a file reader and asigns it the path name of the DICOM directory<BR>
typedef igstk::CTImageReader ReaderType;<BR>
ReaderType::Pointer reader = ReaderType::New();<BR>
ReaderType::DirectoryNameType directoryName = path;<BR>
reader->RequestSetDirectory( directoryName );<BR>
reader->RequestReadImage();<BR>
<BR>
// Generates a pointer to the object which contains de CT image and saves it<BR>
typedef igstk::CTImageSpatialObject CTImageType;<BR>
typedef CTImageType::ConstPointer CTImagePointer;<BR>
CTImagePointer ctImage = reader->GetOutput();<BR>
<BR>
// Generates an Object representation for the vtk visualization<BR>
typedef igstk::CTImageSpatialObjectRepresentation RepresentationType;<BR>
RepresentationType::Pointer representation = RepresentationType::New();<BR>
representation->RequestSetImageSpatialObject( ctImage );<BR>
representation->RequestSetOrientation( RepresentationType::Axial );<BR>
representation->RequestSetSliceNumber( 2 );<BR>
<BR>
// Generates a 2D space where the CT image will be displayed<BR>
typedef igstk::View2D View2DType;<BR>
View2DType *view2D = new View2DType(20,20,512,512,"2D View");<BR>
view2D->RequestResetCamera();<BR>
view2D->RequestEnableInteractions();<BR>
view2D->RequestAddObject( representation );<BR>
<BR>
VTKwin->end();<BR>
VTKwin->show();<BR>
<BR>
return;<BR>
}<BR>
<BR>
// Callback Function for saving the pathname. Calls the function that opens the CTimage<BR>
void get_path(Fl_Widget* o , void* v)<BR>
{<BR>
const char *u;<BR>
char path[256];<BR>
Fl_File_Input *t=(Fl_File_Input*)o;<BR>
u=t->value();<BR>
strcpy(path,u);<BR>
open(path);<BR>
return;<BR>
}<BR>
<BR>
int main(int argc, char **argv)<BR>
{<BR>
// Configures the Global Window<BR>
Fl_Window *window = new Fl_Window(0,0,650,60);<BR>
window->label("Open");<BR>
window->begin();<BR>
<BR>
// Generates the input object to save de pathname<BR>
Fl_File_Input *path=new Fl_File_Input(130,10,500,40,"Path to DICOM Dir");<BR>
path->when(FL_WHEN_ENTER_KEY);<BR>
path->callback(get_path);<BR>
<BR>
window->end();<BR>
window->show(argc, argv);<BR>
<BR>
return Fl::run();<BR>
}<BR>
</FONT>
</P>
</BODY>
</HTML>