[Insight-users] Question about measurements in a volume
Luis Ibanez
luis.ibanez at kitware.com
Wed Dec 22 17:34:21 EST 2004
Hi Sotiris,
1) In order to perform measurements you must
make sure that you have correct values for
the pixel spacing of your volume in physical
units (e.g. millimeters, microns, centimeters).
2) Unfortunately JPEG files do not contain such
information. If you want to make serious
measurements you *MUST* use DICOM images. This
image fileformat will contain correct information
regarding the size of pixels in physical units.
3) JPEG was designed for storing images of natural
scenes using a reasonable lossy compression scheme.
JPEG is good for birthday pictures, your family
photographs, the picture of a house in front of a
lake, and the picture of a dog sitting in the yard.
DICOM was designed for storing medical images, such
as CT, MRI, PET.
For full information about DICOM, you must look at
http://medical.nema.org/
If you are managing medical images you *should not*
use JPEG as a fileformat for your data.
4) VTK uses the convention of Computer Graphics for
the coodinate system: origin on the top-left corner,
and +Y axis pointing down the screen. ITK uses the
convention of math and physics: origin on the bottom
left corner, and +Y axis pointing up the screen.
You must be very careful with this in medical applications
because reverting the +Y axis will lead to confuse
left-right on the patient.
Regards,
Luis
--------------------------
Sotiris Dimopoulos wrote:
> 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
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list