[Insight-users] Re: Seamless VTK-ITK pipeline connection

Luis Ibanez luis.ibanez at kitware.com
Sat Aug 18 16:06:11 EDT 2007


Hi Mutanga,

You are providing a filename that *IS NOT* in the same directory
that you are passing to SetDirectory().

What the reader is telling you now is that you don't have any
DICOM files in the directory:

     "C:/Documents and Settings/592780/Desktop/ct1/"


The way you should use this class is by passing the directory
*and* passing one of the filenames from that same directory
that you want to read.



So, instead of doing:

reader->SetDirectory("C:/Documents and Settings/592780/Desktop/ct1/");
reader->SetFileName(
"D:/MATLAB/R2006a/work/TPS-RPM/results/061179/ct1/1.3.12.2.1107.5.1.4.49339.30000006032906421684300000546.dcm"
);


You should do something like:


reader->SetDirectory("D:/MATLAB/R2006a/work/TPS-RPM/results/061179/ct1/");
reader->SetFileName(
"D:/MATLAB/R2006a/work/TPS-RPM/results/061179/ct1/1.3.12.2.1107.5.1.4.49339.30000006032906421684300000546.dcm"
);


This is, arguably, redundant.

Since you can actually get the directory
from the filename by doing:

   reader->SetFileName( filename );

   std::string directoryName =
   vtksys::SystemTools::GetFilenamePath( filename );

   reader->SetDirectory( directoryName );
   reader->ReadImageSeries();



Please give it a try with the method above
and let us know if you still have any problem.


    Thanks


        Luis



========================
Mutanga Theodore wrote:
> Greetings
> 
> I am still writing about the problem of VTK ITK connection.
> 
> I followed the method you suggested,
> 
>   void SetDirectory( const std::string & directory );
>   void ReadImageSeries();
> 
> But each time I try to read some dicom files ( by specifying first a
> filename and then a directory) I get an error that no series were found. I
> know I can use other tools to load the dicom series in that directory.
> for example I made a tool goind through the typedef method followed by ITK
> export and VTK import and I can read the Dicom slices.
> 
> Here is a sample of the code using the seamles connection method:
> 
> 
> ========================
> void vtkKWMyWindow::OpenCT()
> {
> 
>   vtkKWImageIO * reader = vtkKWImageIO::New();
>   reader->SetDirectory("C:/Documents and Settings/592780/Desktop/ct1/");
>   reader->SetFileName(
> "D:/MATLAB/R2006a/work/TPS-RPM/results/061179/ct1/1.3.12.2.1107.5.1.4.49339.30000006032906421684300000546.dcm"
> );
> 
>    //reader->ReadImage();
>   reader->ReadImageSeries();
> 
>   vtkKWImage *kwImage = reader->HarvestReadImage();
>   vtkImageData *vtkImage = kwImage->GetVTKImage();
> 
>   this->ImageViewer->SetRenderWindow(this->RenderWidget->GetRenderWindow());
>   this->ImageViewer->SetRenderer(this->RenderWidget->GetRenderer());
>   this->ImageViewer->SetInput(vtkImage);
>   this->ImageViewer->SetupInteractor(this->RenderWidget->GetRenderWindow()->GetInteractor());
> 
> 
>   this->RenderWidget->ResetCamera();
> 
> 
> 
> 
> }
> =========================================================================
> 
> 
> With the above code I can read just one slice using ReadImage but when I
> use ReadImageSeries, I always get the error :
> 
> WARNING: In ..\..\..\Code\IO\itkGDCMSeriesFileNames.cxx, line 137
> GDCMSeriesFileNames (0FA7D928): No Series were found
> 
> 
> My question is do you have a working sample of using this new class ? I
> will be easier if you can send me something I can modify. I really like
> the method of using your class to read images.
> 
> Thanks
> 
> theodore
> 
> 
> 
> 


More information about the Insight-users mailing list