From 64f789199d7c134627b31cfaee6e67eb012f48bb Mon Sep 17 00:00:00 2001 From: jean-pierre roux Date: Tue, 19 May 2009 14:42:30 +0000 Subject: [PATCH] Code cleaning --- appli/testBruker2Dicom/testBruker2Dicom.cxx | 7 +++-- lib/src1/bruker2dicom.cxx | 32 ++++++++------------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/appli/testBruker2Dicom/testBruker2Dicom.cxx b/appli/testBruker2Dicom/testBruker2Dicom.cxx index b20536e..bd015e5 100644 --- a/appli/testBruker2Dicom/testBruker2Dicom.cxx +++ b/appli/testBruker2Dicom/testBruker2Dicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: testBruker2Dicom.cxx,v $ Language: C++ - Date: $Date: 2009/05/18 16:33:20 $ - Version: $Revision: 1.2 $ + Date: $Date: 2009/05/19 14:42:30 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) // b2d.day : unused ... b2d.day = am->ArgMgrGetString("day", "You_forget_the_Day"); - delete am; // we don't need Argument Manager any longer + // ----------- End Arguments Manager --------- @@ -172,6 +172,7 @@ int main(int argc, char *argv[]) std::cout << "Exception was thrown :-( " << std::endl; } + delete am; // we don't need Argument Manager any longer } diff --git a/lib/src1/bruker2dicom.cxx b/lib/src1/bruker2dicom.cxx index 7371311..710129b 100644 --- a/lib/src1/bruker2dicom.cxx +++ b/lib/src1/bruker2dicom.cxx @@ -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 Bruker2Dicom::CreateImageSet ( ) return imageSet; } - // =========================================================================================== void Bruker2Dicom::MakeDicomImage(unsigned char *tabPixels, -- 2.47.1