X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Fsrc1%2Fbruker2dicom.cxx;h=0473bb3ac3be310019cbbc36da201c6b931604c2;hb=c4aa711c5d7c94a0a7ace93cabc977f06a9703f9;hp=710129b778aaac8994e8f5d27330b037def324b2;hpb=dc999ac989fde4e454da55bf7f12065b434ab445;p=creaBruker.git diff --git a/lib/src1/bruker2dicom.cxx b/lib/src1/bruker2dicom.cxx index 710129b..0473bb3 100644 --- a/lib/src1/bruker2dicom.cxx +++ b/lib/src1/bruker2dicom.cxx @@ -3,7 +3,7 @@ #include #ifndef PATH_MAX // If not defined yet : do it - #define PATH_MAX 2048 + #define PATH_MAX 2048 #endif @@ -84,35 +84,36 @@ bool Bruker2Dicom::Execute() BrukerFieldData b_name=br_subject.GetFieldData("SUBJECT_name_string"); std::string subject_name = b_name.GetStringValue()[0]; - strPatientName = subject_name; + strPatientName = subject_name; cleanString(subject_name); - + BrukerFieldData b_entry=br_subject.GetFieldData("SUBJECT_entry"); std::string subject_entry = b_entry.GetStringValue()[0]; //cleanString(subject_entry); - subject_entry = subject_entry.substr(11, subject_entry.size()-11); - + subject_entry = subject_entry.substr(11, subject_entry.size()-11); + BrukerFieldData b_position=br_subject.GetFieldData("SUBJECT_position"); std::string subject_position = b_position.GetStringValue()[0]; //cleanString(subject_position); - subject_position = subject_position.substr(9, subject_position.size()-9); - + subject_position = subject_position.substr(9, subject_position.size()-9); + BrukerFieldData b_date=br_subject.GetFieldData("SUBJECT_date"); std::string subject_date = b_date.GetStringValue()[0]; - strStudyTimeDate = subject_date; + strStudyTimeDate = subject_date; cleanString(subject_date); - + 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; + + // subject_name is already in 'Patient Name' + 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(); - + serieNumber = 0; // ----------------------------------------------------- // Iterate to ALL the objets(files/directories) found in the input directory // (this is level ZERO) @@ -161,29 +162,20 @@ bool Bruker2Dicom::Execute() nbSlices = b_list_size.GetIntValue()[0]; strSerieDescr = GDCM_NAME_SPACE::Util::GetName(*it) - + "." + acqp_protocol_location + /* + "." + acqp_protocol_location */ // always the same (in each acquisition) + "." + acqp_scan_name + "." + acqp_method.c_str(); sprintf(outputDirName, "%s%c%s", OutputDirName.c_str(), GDCM_NAME_SPACE::GDCM_FILESEPARATOR, strSerieDescr.c_str() ); - + std::cout << " ================================================================================\n" - << " === [" << GDCM_NAME_SPACE::Util::GetName(*it) << "] -> [" << strSerieDescr << "]\n" + << " === [" << GDCM_NAME_SPACE::Util::GetName(*it) << "] -> [" << strSerieDescr << "]\n" << " ================================================================================" << std::endl; -/* - std::cout << " ================================================================================\n" - << " ========================= [" << GDCM_NAME_SPACE::Util::GetName(*it).c_str() - << acqp_protocol_location.c_str() - << acqp_scan_name.c_str() - << acqp_method.c_str() - << "]\n" - << " ================================================================================" - << std::endl; -*/ + if (verbose) printf ("outputDirName [%s]\n", outputDirName); @@ -571,6 +563,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr // --------------------------- imageSet = CreateImageSet ( ); + serieNumber++; strSerieUID = GDCM_NAME_SPACE::Util::CreateUniqueUID(); if (nbInstants==1) // creer un seul fichier .mhd pour toutes les Slices! (images natives) { @@ -614,6 +607,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr fwrite( buffer_2dseq, NX*NY*pixelSize, nbSlices, fp); } fclose(fp); + serieNumber ++; strSerieUID = GDCM_NAME_SPACE::Util::CreateUniqueUID(); } // end if mhd if (dicom) @@ -633,9 +627,9 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr day, strStudyUID, strSerieUID, - strStudyDescr, + strStudyDescr, strSerieDescr, - strStudyTimeDate, + strStudyTimeDate, 0,// index frame number GDCM_NAME_SPACE::UNMODIFIED_PIXELS_IMAGE ); @@ -652,8 +646,8 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr k = 0; for (sliceNb=0; sliceNb