]> Creatis software - gdcm.git/blobdiff - src/gdcmFile.cxx
Add some comments about pixel spacing
[gdcm.git] / src / gdcmFile.cxx
index e24e4f540ab73f7d3a53349470f00846ed99adc2..9c55ec89dbe7b06e16f140041949b297a6d1e656 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/05/30 08:18:50 $
-  Version:   $Revision: 1.319 $
+  Date:      $Date: 2006/06/08 13:37:33 $
+  Version:   $Revision: 1.321 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -508,6 +508,36 @@ float File::GetXSpacing()
 {
    float xspacing = 1.0;
    uint32_t nbValue;
+/*   
+It *SHOULD* first find the IOD and then deduce which tags to read
+Eg: Cross section this is in Pixel Spacing (0028,0030)
+CR is in Imager Pixel Spacing (0018,1164)
+US is in Pixel Ratio (0028,0034)
+RT is in :
+(3002,0011) Image Plane Pixel Spacing
+(3002,0012) RT Image Position
+and
+(3004,000c) for deducing Z spacing 
+*/
+
+
+//   std::string SOPClassUID = GetEntryString(0x0008,0x0016);
+
+   /// \todo check the various SOP Class
+   ///       to get the Pixel Spacing at the proper location
+   
+       
+   // Ultrasound Image Storage (Retired)
+/* 
+   if (Util::DicomStringEqual( SOPClassUID,"1.2.840.10008.5.1.4.1.1.6")
+   {
+       - check if  SOPClassUID contains 2 parts (e.g. "4\3")
+       - guess how to deduce the spacing (FOV ?, ??)       
+   }
+   else
+   // go on with old method ...
+*/  
 
    // To follow David Clunie's advice, we first check ImagerPixelSpacing
 
@@ -1382,9 +1412,9 @@ void File::AnonymizeNoLoad()
                              ++it)
    { 
    
-   std::cout << "File::AnonymizeNoLoad -------" << std::hex <<(*it).Group <<"|"<< 
-               (*it).Elem 
-               << "[" << (*it).Value << "] "<< std::endl; 
+      //std::cout << "File::AnonymizeNoLoad -------" << std::hex <<(*it).Group <<"|"<< 
+      //         (*it).Elem 
+      //         << "[" << (*it).Value << "] "<< std::dec << std::endl; 
       d = GetDocEntry( (*it).Group, (*it).Elem);
 
       if ( d == NULL)
@@ -1395,16 +1425,20 @@ void File::AnonymizeNoLoad()
          gdcmWarningMacro( "You cannot 'Anonymize' a SeqEntry ");
          continue;
       }
+      
+      valLgth = (*it).Value.size();
+      if (valLgth == 0)
+         continue;
 
       offset = d->GetOffset();
       lgth =   d->GetLength();
       
-      std::cout << "lgth " << lgth << " valLgth " << valLgth << std::endl;
+      //std::cout << "lgth " << lgth << " valLgth " << valLgth << std::endl;
       if (valLgth < lgth)
       {
          spaces = new std::string( lgth-valLgth, ' ');
          (*it).Value = (*it).Value + *spaces;
-         std::cout << "[" << (*it).Value << "] " << lgth << std::endl;
+         //std::cout << "[" << (*it).Value << "] " << lgth << std::endl;
          delete spaces;
       }
       fp->seekp( offset, std::ios::beg );