From: jean-pierre roux Date: Thu, 14 Jan 2010 17:39:37 +0000 (+0000) Subject: Try to fix method vs reco X-Git-Tag: CREATOOLS.2-0-3~25 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=creaBruker.git;a=commitdiff_plain;h=aa4485dd557470a0a7a5e6c1891ddb255d88ee4d Try to fix method vs reco --- diff --git a/lib/src1/bruker2dicom.cxx b/lib/src1/bruker2dicom.cxx index 4f8cd20..5c12857 100644 --- a/lib/src1/bruker2dicom.cxx +++ b/lib/src1/bruker2dicom.cxx @@ -7,8 +7,6 @@ #define PATH_MAX 2048 #endif - - bool Bruker2Dicom::Execute() { // ----- Check input directory name ----- @@ -62,7 +60,6 @@ bool Bruker2Dicom::Execute() bool canOpen; std::string outputFileName; - // BrukerDataSet br_subject; std::string subject; subject = GDCM_NAME_SPACE::Util::GetPath(*(fileNames.begin()))+ @@ -233,7 +230,6 @@ bool Bruker2Dicom::Execute() << " ================================================================================" << std::endl; - if (verbose) printf ("outputDirName [%s]\n", outputDirName); try { @@ -365,7 +361,7 @@ void Bruker2Dicom::DealWithNiveau1(std::string level1Directory, std::string curr // ===================================================================== void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string currentOutputDirName) { - + // e.g. : at level 2 in B67d1.Bp1/6/pdata // // acqp fid imnd pdata pulseprogram spnam0 spnam1 @@ -378,7 +374,7 @@ void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string curr throw ( BrukerHopelessException ("Hopeless! Level2 output directory creation failure")); //exit (0); } - + GDCM_NAME_SPACE::DirList dirList(level2Directory, false, true); // DON'T get recursively the list of files GDCM_NAME_SPACE::DirListType fileNames; @@ -401,7 +397,6 @@ void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string curr { std::cout << "--- --- [" << *it << "] is a file.." << std::endl; } - } for (it = fileNames.begin(); @@ -413,7 +408,7 @@ void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string curr if (verbose) std::cout << "--- --- [" << *it << "] is a directory" << std::endl; - + // sprintf(outputDirName, "%s%c%s", currentOutputDirName.c_str(), // GDCM_NAME_SPACE::GDCM_FILESEPARATOR, // GDCM_NAME_SPACE::Util::GetName(*it).c_str() ); @@ -468,7 +463,6 @@ void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string curr } } - // // ===================================================================== // @@ -545,8 +539,9 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr // GDCM_NAME_SPACE::GDCM_FILESEPARATOR + // "d3proc"; if (verbose) - std::cout << "reco --- => [" << char_reco << "]" << std::endl; - std::string str_reco(char_reco); + std::cout << "reco: --- => [" << char_reco << "]" << std::endl; + + std::string str_reco(char_reco); canOpen = br_reco.LoadFile(str_reco); if (!canOpen) // we try in directory ../1 @@ -556,7 +551,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr std::string lastDirName = GDCM_NAME_SPACE::Util::GetPath(level3Directory); //lastDirName = GDCM_NAME_SPACE::Util::GetPath(lastDirName); sprintf(char_reco,"%s%c1%c%s", lastDirName.c_str(), GDCM_NAME_SPACE::GDCM_FILESEPARATOR,GDCM_NAME_SPACE::GDCM_FILESEPARATOR,"reco" ); - str_reco=char_reco; + //str_reco=char_reco; canOpen = br_reco.LoadFile(str_reco); if (!canOpen) { @@ -564,15 +559,22 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr throw ( BrukerHopelessException ("Hopeless! cannot find 'reco'")); //exit(0); /// \TODO throw an exception ! } + } else { + if (verbose) + std::cout << "[" << str_reco << "] successfully Loaded " << std::endl; } - + canOpen = br_reco.FillMap(); if (!canOpen) { std::cout << "Hopeless! FillMap failed on [" << str_reco << "]" << std::endl; throw ( BrukerHopelessException ("Hopeless! FillMap failed on 'reco'")); - //exit(0); /// \TODO throw an exception ! - } + //exit(0); /// \TODO throw an exception ! + } else { + if (verbose) + std::cout << "[" << str_reco << "] successfully Mapped" << std::endl; + } + //std::cout << "------------------------------------------------------------------------------------------------" << std::cout; // br_reco.PrintSelf(); // std::cout << "------------------------------------------------------------------------------------------------" << std::cout; @@ -623,30 +625,41 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr double spatResolY = spatResol.GetDoubleValue()[1]; if (verbose) std::cout << "SpatResol (ds method) " << spatResolX << " " << spatResolY << std::endl; - BrukerFieldData bsliceDistance = br_method.GetFieldData("PVM_SPackArrSliceDistance"); - - double sliceDistance = bsliceDistance.GetDoubleValue()[0]; + */ +/* ------ */ // Better we use 'get' accessors from BrukerImage class, as Denis wrote them - BrukerFieldData fov = br_reco.GetFieldData("RECO_Fov"); + BrukerFieldData fov = br_reco.GetFieldData("RECO_fov"); double fovX = fov.GetDoubleValue()[0]; double fovY = fov.GetDoubleValue()[1]; if (verbose) - std::cout << "FOV (ds method) " << fovX << " " << fovY << std::endl; + std::cout << "FOV (ds reco) " << fovX << " " << fovY << std::endl; - BrukerFieldData spatResol = br_reco.GetFieldData("RECO_SpatResol"); - double spatResolX = spatResol.GetDoubleValue()[0]; - double spatResolY = spatResol.GetDoubleValue()[1]; + BrukerFieldData size = br_reco.GetFieldData("RECO_size"); + double sizeX = size.GetDoubleValue()[0]; + double sizeY = size.GetDoubleValue()[1]; + if (verbose) - std::cout << "SpatResol (ds method) " << spatResolX << " " << spatResolY << std::endl; + std::cout << "SIZE (ds reco) " << sizeX << " " << sizeY << std::endl; + + double spatResolX = fovX / sizeX; + double spatResolY = fovY / sizeY; + + if (verbose) + std::cout << "spatResol (ds reco : fov/size) " << spatResolX << " " << spatResolY << std::endl; + +/* ------ */ /// \TODO probabely a more sophisticated accessor will be necessary : /// (cf : non contiguous slices, overlapping, slice thickness, space between slices, etc) - BrukerFieldData bsliceDistance = br_method.GetFieldData("RECO_SPackArrSliceDistance"); + BrukerFieldData bsliceDistance = br_method.GetFieldData("PVM_SPackArrSliceDistance"); double sliceDistance = bsliceDistance.GetDoubleValue()[0]; + + if (verbose) + std::cout << "SPackArrSliceDistance (ds method) " << sliceDistance << std::endl; // ----------------------------------------------------------------------------------------