[Dcmlib] Axial dataset and Scout views

Jean-Pierre Roux jpr at creatis.insa-lyon.fr
Thu May 3 12:09:28 CEST 2007


Lazzarato Dr. Gianni wrote:
>
> Hi Users,
>
>              i have a problem with some datasets.
>
> I cannot proper load the main dataset when one or more Latero-Lateral 
> scout views are included in the dataset : only the scout view Is/are 
> loaded.
>
> The problem disappear if I manually erase the scout views from the 
> dataset.
>
> Is there an easy way to bypass gdcm from loading it and only load main 
> axial dataset?
>
> Thank you for the help.
>
>  
>
> Gianni
>
>  
>
>  
>
It's not so easy :
Splitting the file set you find in the directory according to Serie UID 
is very often enough, but in some cases, there are images with different 
orientations, with the same Serie UID.
You have to split again the 'Single Serie UID' file set according to the 
orientation.

  
   gdcm::SerieHelper *s = gdcm::SerieHelper::New();
   s->SetDirectory(dirName, true); // true : recursive exploration

   // The Dicom file set is splitted into several 'Single SerieUID FileSets'
   // (a 'Single SerieUID Files Set' per SerieUID)
   // In some cases, it's not enough, since, in some cases
   // we can find scout view with the same SerieUID

   int nbFiles;
   std::string fileName;
   // For all the Single SerieUID Files Sets of the gdcm::Serie
  
   gdcm::FileList *l = s->GetFirstSingleSerieUIDFileSet();
  
   gdcm::XCoherentFileSetmap xcm;
   while (l) // for each 'Single SerieUID FileSet'
   {
      nbFiles = l->size() ;
      if ( l->size() > 3 ) // Why not ? Just an example, for testing
                           // A "Single SerieUID FileSet' with too few 
images has no interest (?)
      {
         std::cout << "Split the 'Single SerieUID' FileSet :["
                   << s->GetCurrentSerieUIDFileSetUID()
                   << "]  " << nbFiles << " long" << std::endl;
         std::cout << "-----------------------------------" << 
std::endl;     
 
         // Here, we consider that, within a "Single SerieUID FileSet', 
we can find varios orientations
         xcm = s->SplitOnOrientation(l); // hopefully, Scout views have 
not the same 'orientation'
                                     //  than other images
   
      // within a XCoherentFileSet (Extra Coherent -sorry for the name- )
     // all the files have same orientation
     
         for (gdcm::XCoherentFileSetmap::iterator i = xcm.begin();
                                                  i != xcm.end();
                                                ++i)
         {
            // Just to see what the current XCoherentFileSet contains
            std::cout << "-------------------- [" << (*i).first << "]" 
<< std::endl;  
            for (gdcm::FileList::iterator it =  ((*i).second)->begin();
                                          it != ((*i).second)->end();
                                        ++it)
            {
               fileName = (*it)->GetFileName();
               std::cout << "    " << fileName << std::endl;
            }
            std::cout << std::endl;  
         }

       // Manage to guess which one you want to work with.
       // (check number of files, for instance)
       // and break when you find it.

      }
      l = s->GetNextSingleSerieUIDFileSet();
   }


// ...
     
   s->OrderFileList((*i).second);  // sort the XCoherent Fileset you 
decided to work with
    
  vtkGdcmReader *reader = vtkGdcmReader::New();
// ...
  SetCoherentFileList(l);
  reader->Update();

HTH

Jean-Pierre Roux
  
    



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.creatis.insa-lyon.fr/pipermail/dcmlib/attachments/20070503/478cc735/attachment.html>


More information about the Dcmlib mailing list