#define PATH_MAX 2048
#endif
-
-
bool Bruker2Dicom::Execute()
{
// ----- Check input directory name -----
bool canOpen;
std::string outputFileName;
-
// BrukerDataSet br_subject;
std::string subject;
subject = GDCM_NAME_SPACE::Util::GetPath(*(fileNames.begin()))+
<< " ================================================================================"
<< std::endl;
-
if (verbose)
printf ("outputDirName [%s]\n", outputDirName);
try {
// =====================================================================
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
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;
{
std::cout << "--- --- [" << *it << "] is a file.." << std::endl;
}
-
}
for (it = fileNames.begin();
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() );
}
}
-
//
// =====================================================================
//
// 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
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)
{
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;
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;
// ----------------------------------------------------------------------------------------