]> Creatis software - creaBruker.git/blobdiff - lib/src1/bruker2dicom.cxx
Code cleaning
[creaBruker.git] / lib / src1 / bruker2dicom.cxx
index 737131192fa455e3b24bcd6484f30d1331931bd0..710129b778aaac8994e8f5d27330b037def324b2 100644 (file)
@@ -37,7 +37,7 @@ bool Bruker2Dicom::Execute()
    GDCM_NAME_SPACE::DirList dirList(strDirNamein, false, true); // DON'T get recursively the list of files
    std::string strDirNameout(OutputDirName);   
 
-/*   
+/*
    if (listonly)
    {
       std::cout << "------------List of found files ------------" << std::endl;
@@ -58,6 +58,7 @@ bool Bruker2Dicom::Execute()
    bool canOpen;
    std::string outputFileName;
 
+
   // BrukerDataSet br_subject;
    std::string subject;
    subject = GDCM_NAME_SPACE::Util::GetPath(*(fileNames.begin()))+
@@ -80,11 +81,7 @@ bool Bruker2Dicom::Execute()
 
   // get info for 'Study Description'
   
- /*
-         BrukerFieldData b_protocol_location=br_acqp.GetFieldData("ACQ_protocol_location");
-         acqp_protocol_location = b_protocol_location.GetStringValue()[0];
-         cleanString(acqp_protocol_location);
-*/
+
          BrukerFieldData b_name=br_subject.GetFieldData("SUBJECT_name_string");
          std::string subject_name = b_name.GetStringValue()[0];
         strPatientName = subject_name;
@@ -107,11 +104,11 @@ bool Bruker2Dicom::Execute()
         
          BrukerFieldData b_study_name=br_subject.GetFieldData("SUBJECT_study_name");
          std::string subject_study_name = b_study_name.GetStringValue()[0];
-        subject_study_name = subject_study_name.substr(1, subject_study_name.size()-2);         
+        subject_study_name = subject_study_name.substr(1, subject_study_name.size()-2);
          cleanString(subject_date);
         
    strStudyDescr = subject_name + "." + subject_study_name + "." + subject_entry + "." + subject_position + "." + subject_date;
-                
+
    char outputDirName[(unsigned int) PATH_MAX+2];
 
    strStudyUID =  GDCM_NAME_SPACE::Util::CreateUniqueUID();
@@ -128,7 +125,6 @@ bool Bruker2Dicom::Execute()
          it != fileNames.end();
        ++it)
    {
-      if ( !boost::filesystem::is_regular(*it) ) // check twice !
       if ( boost::filesystem::is_directory(*it) )
       { 
          if (verbose)
@@ -227,7 +223,7 @@ void Bruker2Dicom::DealWithNiveau1(std::string level1Directory, std::string curr
       //if ( ! boost::filesystem::is_directory(*it) )
       {
          if (verbose)
-            std::cout << "--- [" << *it << "] is a file" << std::endl;
+            std::cout << "--- [" << *it << "] is a file." << std::endl;
       }  
    }
 
@@ -238,7 +234,6 @@ void Bruker2Dicom::DealWithNiveau1(std::string level1Directory, std::string curr
         it != fileNames.end();
       ++it)
    {
-      if ( !boost::filesystem::is_regular(*it) ) // check twice !  
       if ( boost::filesystem::is_directory(*it) )
       {
          // will be always "pdata" ...
@@ -335,10 +330,9 @@ void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string curr
         it != fileNames.end();
       ++it)
    {
-      if ( !boost::filesystem::is_regular(*it) ) 
-      //if ( ! boost::filesystem::is_directory(*it) )
+      if ( ! boost::filesystem::is_directory(*it) )
       { 
-         std::cout << "--- --- [" << *it << "] is a file" << std::endl;
+         std::cout << "--- --- [" << *it << "] is a file.." << std::endl;
       }
       
    }
@@ -347,7 +341,6 @@ void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string curr
          it != fileNames.end();
        ++it)
    {
-      if ( !boost::filesystem::is_regular(*it) ) // check twice !
       if ( boost::filesystem::is_directory(*it) )
       { 
   
@@ -438,7 +431,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr
    sprintf(char_d3proc,"%s%c%s", level3Directory.c_str(), GDCM_NAME_SPACE::GDCM_FILESEPARATOR,"d3proc" );     
    
    if (verbose)
-      std::cout << "--- => [" << char_d3proc << "]" << std::endl;
+      std::cout << "try d3proc: --- => [" << char_d3proc << "]" << std::endl;
    std::string str_d3proc(char_d3proc);       
    canOpen = br_d3proc.LoadFile(str_d3proc);
 
@@ -467,7 +460,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr
     //             GDCM_NAME_SPACE::GDCM_FILESEPARATOR +
     //             "d3proc";
    if (verbose)
-      std::cout << "--- => [" << char_reco << "]" << std::endl;
+      std::cout << "try reco --- => [" << char_reco << "]" << std::endl;
    std::string str_reco(char_reco);       
    canOpen = br_reco.LoadFile(str_reco);
 
@@ -529,7 +522,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr
       std::cout << "FOV (ds method) " << fovX << " " << fovY << std::endl;
 
    /// \TODO probabely a more sophisticated accessor will be necessary :
-   ///  (cf : non contiguous slices, overlapping, slice thickness, space between clices, etc)
+   ///  (cf : non contiguous slices, overlapping, slice thickness, space between slices, etc)
    BrukerFieldData bsliceDistance = br_method.GetFieldData("PVM_SPackArrSliceDistance");
    double sliceDistance = bsliceDistance.GetDoubleValue()[0];
 
@@ -825,7 +818,7 @@ void Bruker2Dicom::dealWithCarto(GDCM_NAME_SPACE::DirListType &fileNames, int NX
       //if ( ! boost::filesystem::is_directory(*it) )
       {         
          if (verbose)
-            std::cout << "--- [" << *it << "] is a file" << std::endl;
+            std::cout << "--- [" << *it << "] is a file..." << std::endl;
 
          icode = 0;
 
@@ -1117,7 +1110,6 @@ std::vector<BrukerImage> Bruker2Dicom::CreateImageSet ( )
    return imageSet;
 }
 
-
 // ===========================================================================================
 
 void Bruker2Dicom::MakeDicomImage(unsigned char *tabPixels,