[Insight-users] Slice order comes wrong when reading a DICOM files (one slice per file) to form a volume

Desikachari Nadadur dnadadur at intio.us
Mon Jun 21 18:07:15 EDT 2010


Hi All,

I searched the forum but I could not find any answer to my question. So, 
I am posting here.

When reading a set of CT DICOM files (with one file per slice) to form a 
volume, the slice ordering comes out wrong for some datasets. This also 
seems system dependent. For example the same dataset works on FreeBSD 
8.0 and fails on Debian (Stable) Linux. Here "fails" means wrong order 
of slices. Also, the ordering seems to coincide with the filename 
ordering on the disk in these failed cases. When I do "ls -f" on these 
systems, FreeBSD 8.0 shows all the files with disk ordering coinciding 
with volume's slice ordering. However, on Debian Linux, it is not the 
case. 99% of the time I am able to successfully read the datasets even 
if the file ordering on the disk is not the volume slice ordering. Looks 
like I am not using a much needed DICOM tag in getting the slice 
ordering correct. Here is the code segment where I call 
AddSeriesRestriction () to set the tags to base sorting upon while 
reading the series of files. There is no sorting based on InstanceNumber 
and I did not know how to implement it here. I am using ITK 3.14.0 with 
GDCM 2.0.12.  Any suggestions to fix this problem would be appreciated.

<CODE>
        ITKNamesGeneratorType :: Pointer nameGenerator = 
ITKNamesGeneratorType :: 
New();                                                                                                       

        nameGenerator->SetUseSeriesDetails( true );
                                                                                                        

        // We want to add two more criteria for sorting 
filenames                                      
        //  * 0008|0021   Series 
Date                                                                  
        //  * 0020|0012   Acquisition 
Number                                                           
        // using the call to 
AddSeriesRestriction()                                                    
        
//                                                                                              

        nameGenerator->AddSeriesRestriction( "0008|0021" ); // DA 1 
Series Date                        
        nameGenerator->AddSeriesRestriction( "0020|0012" ); // 
Acquisition Number                      
                                                                                                        

        nameGenerator->SetDirectory( filename 
);                                                       
                                                                                                        

        typedef std :: vector< std :: string >    
SeriesIdContainer;                               
        const SeriesIdContainer & seriesUID = 
nameGenerator->GetSeriesUIDs();                      
                                                                                                        
                                                                                                       

        std :: string 
seriesIdentifier;                                                             

        seriesIdentifier = seriesUID.begin()->c_str();
 
        typedef std :: vector< std :: string >   
FileNamesContainer;                               
        FileNamesContainer 
fileNames;                                                              
        fileNames = nameGenerator->GetFileNames( seriesIdentifier 
);                               
                                                                                                        

        class ITKSeriesReaderType :: Pointer itkReader = 
ITKSeriesReaderType :: New();              
                                                                                                       

        itkReader->SetImageIO( itkGdcmImageIO 
);                                                    
                                                                                                       

        itkReader->SetFileNames( fileNames 
);                                                      
                                                                                                        

        
itkReader->Update();                                                                    

</CODE>

Thanks in advance,
Desika

--
Desikachari Nadadur, PhD
INTIO, Inc.



More information about the Insight-users mailing list