[Insight-users] Question about measurements in a volume

Sotiris Dimopoulos vtksot_dimopoulos at yahoo.gr
Tue Dec 21 10:15:46 EST 2004


Hi!

I have a pack of CT slices ( JPEG & DICOM format ) and
i want use itk for the image processing and vtk for
the visualization...I have this questions :

1)Will i be able to obtain *measurements* in the
volume that i'll produce (which wiil be displayed in
vtk) for the images in the formats that i have?
 
2)Does JPEAG format give that information?

3)Which is the difference between dicom & jpeag
format?  

And something else...

I've done the reading of an image in both formats and
when a dispay the image in vtk,a get it upside down...
(the code is at the end).Why is that???


Thanks in advance!

//itk include files

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageToVTKImageFilter.h"
#include "itkDICOMImageIO2.h"

//vtk include files

#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkActor2D.h"
#include "vtkImageMapper.h"
#include "vtkRenderWindowInteractor.h"



int main( int , char ** argv)
{
  

  
  typedef itk::Image<signed short,2>             
ImageType;
  typedef itk::ImageFileReader< ImageType >      
ReaderType;

// Create the dicom reader

  itk::DICOMImageIO2::Pointer dicomIO =
itk::DICOMImageIO2::New();

  ReaderType::Pointer reader = ReaderType::New();

 const char * filename = "C:/Documents and
Settings/sotiris/Desktop/OSTA/osta
3,5/DICOM/1.2.840.113619.2.22.287.1.3371.20041110.303616/1.2.840.113619.2.22.287.1.3371.2.20041110.303732/1.2.840.113619.2.22.287.1.3371.2.46.20041110.304236.dcm";
  

  reader->SetFileName( filename );

  reader->SetImageIO( dicomIO );

 
  reader->Update();



    ImageType::Pointer image = reader->GetOutput();
  
    
	//Get the origin of the image
	
	
	const ImageType::PointType& orgn =
image->GetOrigin();

     std::cout << "Origin = ";
     std::cout << orgn[0] << ", " << orgn[1] <<
std::endl;

 
	 //Get the Spacing

    const ImageType::SpacingType& sp =
image->GetSpacing();  

    std::cout << "Spacing = ";
    std::cout << sp[0] << ", " << sp[1] << std::endl;

  //Check the dimensions...How???

  //Exit the itk pipeline and enter the vtk pipeline
   
   typedef itk::ImageToVTKImageFilter<ImageType>
ConnectorType;   
   
   ConnectorType::Pointer connector=
ConnectorType::New();
   connector->SetInput(reader ->GetOutput() );


    // Create the Image Mapper

    vtkImageMapper *mapper = vtkImageMapper::New();
         mapper -> SetInput(connector -> GetOutput());
         mapper -> SetColorWindow(255);
         mapper -> SetColorLevel(128);
        
     // Create the Actor

    vtkActor2D *actor = vtkActor2D::New();
         actor -> SetMapper(mapper);


     // Create the Rendering Window for viewing what
you've done

    vtkRenderer *imager = vtkRenderer::New();
           imager -> AddActor2D(actor);
       
  
    vtkRenderWindow *imgWin = vtkRenderWindow::New();
           imgWin -> AddRenderer(imager);
           
              
    vtkRenderWindowInteractor *iren =
vtkRenderWindowInteractor::New();
           iren -> SetRenderWindow(imgWin);
           
           imager->SetBackground(1,1,1);
           imgWin->SetSize(500,500);


    imgWin -> Render();
    iren->Start();

    
  // Clean up
          
         mapper -> Delete();
	     actor -> Delete();
		 imager -> Delete();
		 imgWin -> Delete();
         iren -> Delete();
 

 return 0;
}




____________________________________________________________
Do You Yahoo!?
Αποκτήστε τη δωρεάν @yahoo.gr διεύθυνση σας στο http://www.otenet.gr


More information about the Insight-users mailing list