[Dcmlib] New feature : SerieHelper + vtkGdcmReader

Jean-Pierre Roux jpr at creatis.insa-lyon.fr
Sat Jul 30 20:45:44 CEST 2005


 Many users expect from vtkGdcmReader it 'orders' the images
     (that's the job of gdcm::SerieHelper ...)
     When user *knows* the files with same Serie UID
       have same sizes, same 'pixel' type, same color convention, ...
     the right way to proceed is as follow :

      gdcm::SerieHelper *sh= new gdcm::SerieHelper();
//      if user wants *not* to load some parts of the file headers
      sh->SetLoadMode(loadMode);

//      if user wants *not* to load some files
      sh->AddRestriction(group, element, value, operator);
      sh->AddRestriction( ...
      sh->SetDirectory(directoryWithImages);

//      if user wants to sort reverse order
      sh->SetSortOrderToReverse();

//      here, we suppose only the first Coherent File List is of interest
      gdcm::FileList *l = sh->GetFirstCoherentFileList();

//      if user is doesn't trust too much the files with same Serie UID
      if ( !sh->IsCoherent(l) )
         return; // not same sizes, or not same 'pixel type' -> stop

      sh->OrderFileList(l);        // sort the list

      vtkGdcmReader *reader = vtkGdcmReader::New();
//      if user wants to modify pixel order (Mirror, TopDown, 90°Rotate, 
...)
//      he has to supply the function that does the job
//      (a *very* simple example is given in vtkgdcmSerieViewer.cxx)
      reader->SetUserFunction (userSuppliedFunction);

//      to pass a 'Coherent File List' as produced by gdcm::SerieHelper
      reader->SetCoherentFileList(l);
      reader->Update();

You can see a full example in vtkgdcmSerieViewer
e.g.
vtkgdcmSerieViewer dirname=Dentist  mirror
vtkgdcmSerieViewer dirname=Dentist  reverse
vtkgdcmSerieViewer dirname=Dentist  reverse topdown

Jena-Pierre




More information about the Dcmlib mailing list