]> Creatis software - creaBruker.git/blobdiff - lib/src1/bruker2dicom.cxx
- use creaBruker_EXPORT
[creaBruker.git] / lib / src1 / bruker2dicom.cxx
index b1e939267edf00570b4358100149a86862cd1f40..8ac2129b0de2295420f5f5e902cac9f002fc028d 100644 (file)
@@ -83,7 +83,7 @@ bool Bruker2Dicom::Execute()
  
    switch (type)
    {
-      case 1: {   
+      case 1: {
          bool canOpen = br_subject.LoadFile(subject);
          if (!canOpen)
          {
@@ -491,32 +491,32 @@ void Bruker2Dicom::DealWithNiveau2(std::string &level2Directory, std::string &cu
        ++it)
    {
       if ( boost::filesystem::is_directory(*it) )
-      { 
-  
+      {
+
          if (verbose)
             std::cout << "--- --- [" << *it << "] is a directory" << std::endl;
 
-        // sprintf(outputDirName, "%s%c%s", currentOutputDirName.c_str(), 
+        // sprintf(outputDirName, "%s%c%s", currentOutputDirName.c_str(),
         //                          GDCM_NAME_SPACE::GDCM_FILESEPARATOR,
         //                                GDCM_NAME_SPACE::Util::GetName(*it).c_str() );
   // MUST be 'pdata'!
 
 //
 // (interest of previous method :
-// If unaware user changed the pdata name, it goes on working   
+// If unaware user changed the pdata name, it goes on working
 //
           std::string str_isa;
           str_isa = (*it) + 
                     GDCM_NAME_SPACE::GDCM_FILESEPARATOR +
                    "isa";
 
-          std::string str_isa_func_name;    
+          std::string str_isa_func_name
           canOpen = br_isa.LoadFile(str_isa);
           if (!canOpen)
           {
              sprintf(outputDirName, "%s%c%s", currentOutputDirName.c_str(), 
                                           GDCM_NAME_SPACE::GDCM_FILESEPARATOR,
-                                          GDCM_NAME_SPACE::Util::GetName(*it).c_str() );        
+                                          GDCM_NAME_SPACE::Util::GetName(*it).c_str() )
           }
           else
           {
@@ -546,7 +546,7 @@ void Bruker2Dicom::DealWithNiveau2(std::string &level2Directory, std::string &cu
             std::cout << "And Init Exception was thrown in DealWithNiveau3 (" << e.what() << "); " 
                       << " We skip [" << level2Directory << "]" << std::endl;
             continue;
-         }          
+         }
       }
    }
 }
@@ -597,7 +597,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string &level3Directory, std::string &cu
 
    if (verbose)
       std::cout << "d3proc: --- => [" << char_d3proc << "]" << std::endl;
-   std::string str_d3proc(char_d3proc);       
+   std::string str_d3proc(char_d3proc);     
    canOpen = br_d3proc.LoadFile(str_d3proc);
 
    if (!canOpen)
@@ -612,7 +612,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string &level3Directory, std::string &cu
    {
       std::cout << "Hopeless! FillMap failed on 'd3proc'" << std::endl;
       throw ( BrukerHopelessException ("Hopeless! FillMap failed on 'd3proc'"));      
-      //exit(0);  /// \TODO throw an exception !     
+      //exit(0);  /// \TODO throw an exception !
    }
 
    //-------------- end try d3proc;
@@ -661,7 +661,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string &level3Directory, std::string &cu
    } else {
       if (verbose)
          std::cout << "[" << str_reco << "] successfully Mapped" << std::endl;
-   }   
+   }
 
    //std::cout << "------------------------------------------------------------------------------------------------" << std::cout;
    // br_reco.PrintSelf();
@@ -1287,7 +1287,7 @@ void Bruker2Dicom::cleanString(std::string &s)
 
    if (s[0] == '<')      
       s= s.substr(1,l-2);
-   std::string repChar("_");   
+   std::string repChar("_");
    GDCM_NAME_SPACE::Util::ReplaceSpecChar(s, repChar);
 }
 
@@ -1390,6 +1390,7 @@ std::vector<BrukerImage> Bruker2Dicom::CreateImageSet ( )
 
  // Just for checking
  /*
+
          std::vector<std::vector <double> > imageOrientation;
          std::vector <double> imagePosition; 
          for(int i=0;i<brukerImageList.size();i++)
@@ -1439,7 +1440,7 @@ void Bruker2Dicom::MakeDicomImage(unsigned char *tabPixels,
    std::ostringstream str;
 
    GDCM_NAME_SPACE::File *file;
-   file = GDCM_NAME_SPACE::File::New();       
+   file = GDCM_NAME_SPACE::File::New();
 
   // Set the image size
    str.str(""); 
@@ -1459,7 +1460,9 @@ void Bruker2Dicom::MakeDicomImage(unsigned char *tabPixels,
   // Set the pixel type
   //      //8, 16, 32, 64 (for double ?)
    str.str("");
-   str << pixelSize*8;     
+   str << pixelSize*8;
+
+  // Bits Allocated
    file->InsertEntryString(str.str(),0x0028,0x0100,"US"); // Bits Allocated
 
    file->InsertEntryString(str.str(),0x0028,0x0101,"US"); // Bits Stored
@@ -1640,7 +1643,7 @@ std::cout << "charImageOrientation  " <<
           if (i!=AoImages[0])
              str << "\\";
       }
-      file->InsertEntryString(str.str(),0x0029,0x0104,"DS"); // Valeurs de b          
+      file->InsertEntryString(str.str(),0x0029,0x0104,"DS"); // Valeurs de b
    }   
 
 // 0020 0x1041 DS 1 Slice Location 
@@ -1660,7 +1663,7 @@ std::cout << "charImageOrientation  " <<
 
    GDCM_NAME_SPACE::FileHelper *fileH;
    fileH = GDCM_NAME_SPACE::FileHelper::New(file);
-   fileH->SetContentType(contentType);   
+   fileH->SetContentType(contentType);
 
    // cast is just to avoid warnings (*no* conversion is performed)
    //fileH->SetImageData((uint8_t *)img,int(maxX*maxY)*sizeof(uint16_t)); // troubles when maxX, mayY are *actually* float!