[vtkusers] vtkDICOMImageReader and an extrange error,..
    Dongqing Chen 
    dqchen at cvip.louisville.edu
       
    Fri Mar 13 15:21:08 EDT 2009
    
    
  
Hello, Miguel:
  The C code patch has been tested just recently, it reads all the all the 
DICOM Image, and shows slice-by-slice an independent window.
  it works well for me. Hopefully it helps.
//-----------------------------------------------------------------------------------------------------------------------------------------
    vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
    vtkImageViewer *viewer = vtkImageViewer::New();
     reader->SetDirectoryName(dirName);//change to the folder where your 
docom images are saved.
    viewer->SetInput(reader->GetOutput());
    reader->Update();
    double *dicom_range = reader->GetOutput()->GetScalarRange(); //max and 
mim CT number in Hounsfiled
    int num_slices = viewer->GetWholeZMax ();
     for (int i=0;i<=num_slices;i++)
     {
      int dicom_width=reader->GetWidth();
       int dicom_height=reader->GetHeight();
       double *dicom_spacing=reader->GetPixelSpacing();
       const char *dicom_patient_name=reader->GetPatientName();
    printf("-------------------------------------------------\n");
    printf("This Is Slice Number %d out of Total %d\n", i,num_slices);
    printf("Some Basic Info for Slice Number %d \n", i);
    printf("Weight=%d \n", dicom_width);
    printf("Height=%d \n", dicom_height);
    printf("Spatial Resoltion=[%5.3f,%5.3f,%5.3f]\n", 
dicom_spacing[0],dicom_spacing[1],dicom_spacing[2]);
    printf("-------------------------------------------------\n");
       viewer->SetZSlice(i);
       viewer->GetRenderer()->ResetCameraClippingRange();
       viewer->SetColorWindow(400);
       viewer->SetColorLevel(128);
       viewer->Render();
}
     printf("Max and Min Pixel Values for the Whole 
Dataset=[%9.3f,%9.3f]\n", dicom_range[1],dicom_range[0]);
     reader->Delete();
     viewer->Delete();
//----------------------------------------------------------------------------------------------------------------------------------
Best Wishes,
-----------------------------------------------------------------------------
Dongqing Chen, Ph.D.
Computer Vision & Image Processing (CVIP) Lab
Department of Electrical & Computer Engineering
Speed School of Engineering
University of Louisville
Louisville, KY, 40292
U.S.A
email: dqchen at cvip.louisville.edu
phone: 1-502-852-2789 (Lab)
             1-502-852-6130 (Office)
----------------------------------------------------------------------------
----- Original Message ----- 
From: "Miguel Angel Rodriguez Florido" <marf at itccanarias.org>
To: <vtkusers at vtk.org>
Sent: Friday, March 13, 2009 9:01 AM
Subject: [vtkusers] vtkDICOMImageReader and an extrange error,..
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: 
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
    
    
More information about the vtkusers
mailing list