#define PATH_MAX 2048
#endif
- bool Bruker2Dicom::Execute()
- {
-
- //--- first, Test the system----//
- bool bigEndian = gdcm::ByteSwap<uint16_t>::SystemIsBigEndian();
- gdcm::SwapCode sc = gdcm::SwapCode::Unknown;
- if ( gdcm::ByteSwap<uint16_t>::SystemIsBigEndian() )
- {
- sc = gdcm::SwapCode::BigEndian;
- }
- else if ( gdcm::ByteSwap<uint16_t>::SystemIsLittleEndian() )
- {
- sc = gdcm::SwapCode::LittleEndian;
- }
- else // sc == gdcm::SwapCode::Unknown
- {
- return 1;
- }
+bool Bruker2Dicom::Execute()
+{
+
+//--- first, Test the system----//
+ bool bigEndian = gdcm::ByteSwap<uint16_t>::SystemIsBigEndian();
+ gdcm::SwapCode sc = gdcm::SwapCode::Unknown;
+ if ( gdcm::ByteSwap<uint16_t>::SystemIsBigEndian() )
+ {
+ sc = gdcm::SwapCode::BigEndian;
+ }
+ else if ( gdcm::ByteSwap<uint16_t>::SystemIsLittleEndian() )
+ {
+ sc = gdcm::SwapCode::LittleEndian;
+ }
+ else // sc == gdcm::SwapCode::Unknown
+ {
+ return 1;
+ }
- // ----- Check input directory name -----
+ // ----- Check input directory name -----
if ( ! boost::filesystem::is_directory(InputDirName) )
{
std::cout << "KO : [" << InputDirName << "] is not a Directory." << std::endl;
std::cout << "OK : [" << InputDirName << "] is a Directory." << std::endl;
}
- // ----- Check output directory name -----
+ // ----- Check output directory name -----
if ( ! boost::filesystem::is_directory(OutputDirName) )
{
bool res=CreateDirectory(OutputDirName);
// ----------------------------------------------------------------------------------------------------------
-void Bruker2Dicom::DealWithMultiStudyDirectory (gdcm::Directory::FilenamesType &dirNames,const std::string ¤tOutputDirName)
+void Bruker2Dicom::DealWithMultiStudyDirectory (gdcm::Directory::FilenamesType &dirNames, const std::string ¤tOutputDirName)
{
gdcm::Directory::FilenamesType::iterator it;
subjectFound = false;
if (verbose)
std::cout << "in 'DealWithMultiStudyDirectory' [" << *it << "] is a directory" << std::endl;
-
+
gdcm::Directory dirList;
dirList.Load(*it);
gdcm::Directory::FilenamesType fileNames;
// ----------------------------------------------------------------------------------------------------------
-void Bruker2Dicom::DealWithSingleStudyDirectory (const std::string &dirname, const std::string &i_outputDir) //(gdcm::Directory::FilenamesType &fileNames)
+//void Bruker2Dicom::DealWithSingleStudyDirectory (const std::string &dirname, const std::string &i_outputDir) //(gdcm::Directory::FilenamesType &fileNames)
+void Bruker2Dicom::DealWithSingleStudyDirectory (const std::string dirname, const std::string i_outputDir)
{
bool res;
- // creation directory : 'nom du patient'
+ // creation directory : 'nom du patient'
std::string output = createDirectory(subject_name.c_str(), i_outputDir);
-
+
if (subjectFound)
{
BrukerFieldData b_entry=br_subject.GetFieldData("SUBJECT_entry");
{
strAcqp = (*it_level).string();
nameAcqp = (*it_level).filename();
- boost::algorithm::replace_all( strAcqp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
+ boost::algorithm::replace_all( strAcqp, INVALID_FILE_SEPARATOR, VALID_FILE_SEPARATOR);
bAcqp = true;
}
else if (boost::filesystem::is_directory( (*it_level) ) && nextLevel == "")
BrukerFieldData b_protocol_location=br_acqp.GetFieldData("ACQ_protocol_location");
acqp_protocol_location = b_protocol_location.GetStringValue()[0];
cleanString(acqp_protocol_location);
-
+
BrukerFieldData b_scan_name=br_acqp.GetFieldData("ACQ_scan_name");
acqp_scan_name = b_scan_name.GetStringValue()[0];
cleanString(acqp_scan_name);
b_method.PrintSelf(); // why?
acqp_method = b_method.GetStringValue()[0];
cleanString(acqp_method);
-
+
BrukerFieldData b_list_size = br_acqp.GetFieldData("ACQ_O1_list_size");
nbSlices = b_list_size.GetIntValue()[0];
- strSerieDescr = fname
+ strSerieDescr = fname
+ "." + acqp_scan_name
+ "." + acqp_method.c_str();
/*sprintf(outputDirName, "%s%c%s", i_outputDir.c_str(), VALID_FILE_SEPARATOR, strSerieDescr.c_str() );
std::string temp(outputDirName);
- boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);*/
+ boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR, VALID_FILE_SEPARATOR);*/
output = createDirectory(strSerieDescr, output);
if (verbose)
- printf ("outputDirName [%s]\n", output);
+ printf ("outputDirName [%s]\n", output.c_str());
try {
-
- DealWithNiveau1( (*it).string(), output);
- }
- catch (BrukerHopelessException &e)
- {
- std::cout << "And Exception was thrown in DealWithNiveau1 (" << e.what() << ") " << std::endl;
- continue;
- }
- }
+ DealWithNiveau1( (*it).string(), output);
+ }
+ catch (BrukerHopelessException &e)
+ {
+ std::cout << "And Exception was thrown in DealWithNiveau1 (" << e.what() << ") " << std::endl;
+ continue;
+ }
+ }
}
} // end of : for (GDCM_NAME_SPACE::DirListType::iterator it
}
// =====================================================================
-void Bruker2Dicom::DealWithNiveau1(std::string &level1Directory, std::string ¤tOutputDirName) {
+void Bruker2Dicom::DealWithNiveau1(std::string level1Directory, std::string currentOutputDirName) {
//
// e.g. : at level 1, in B67d1.Bp1/6
//
// acqp fid imnd pdata pulseprogram spnam0 spnam1
-
+
//gdcm::Directory dirList;
//dirList.Load(level1Directory); // DON'T get recursively the list of files
//gdcm::Directory::FilenamesType fileNames;
//fileNames = dirList.GetFilenames();
-
+
// -----------------------------------------------------
// Iterate to ALL the objets(files/directories) found in the input directory
// -----------------------------------------------------
##$PVM_NSPacks=2
##$PVM_SPackArrNSlices=( 2 )
7 1
- */
+ */
br_method.FillMap();
-
+
try
{
boost::filesystem::directory_iterator itDir(level1Directory), it_end;
std::string output = createDirectory( (*itDir).leaf() , currentOutputDirName);
// will be always "pdata" ...
boost::filesystem::directory_iterator itDirInside(*itDir), it_inside_end;
- for(; itDirInside != it_end; ++it)
- {
- // we take the first and hope that we have only one!
- if ( boost::filesystem::is_directory(*itDirInside))
- {
- output = createDirectory( (*itDirInside).leaf() , output);
- DealWithNiveau2( (*itDirInside).string(), output);
- }
- }
- }
- }
+ for(; itDirInside != it_end; ++it)
+ {
+ // we take the first and hope that we have only one!
+ if ( boost::filesystem::is_directory(*itDirInside))
+ {
+ output = createDirectory( (*itDirInside).leaf() , output);
+ DealWithNiveau2( (*itDirInside).string(), output);
+ }
+ }
+ }
+ }
}
catch(BrukerHopelessException &e)
{
std::cout << "And Exception was thrown in DealWithNiveau2 (" << e.what() << ") " << std::endl;
}
-
+
}
// =====================================================================
-void Bruker2Dicom::DealWithNiveau2(std::string &level2Directory, std::string ¤tOutputDirName) {
+void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string currentOutputDirName) {
// e.g. : at level 2 in B67d1.Bp1/6/pdata
//
std::string str_isa_func_name = b_isa_func_name.GetStringValue()[0];
cleanString(str_isa_func_name);
output = createDirectory(str_isa_func_name, currentOutputDirName);
-
+
}
break;
}
{
std::cout << "And Exception was thrown in DealWithNiveau3 (" << e.what() << "); "
<< " We skip [" << level2Directory << "]" << std::endl;
-
+
}
catch (BrukerInitException &e)
{
std::cout << "And Init Exception was thrown in DealWithNiveau3 (" << e.what() << "); "
<< " We skip [" << level2Directory << "]" << std::endl;
-
- }
-
+
+ }
}
//
// -------------------try reco
-
+
std::string str_reco = level3Directory + VALID_FILE_SEPARATOR + "reco";
canOpen = br_reco.LoadFile(findFile( level3Directory, "reco"));
if (!canOpen)
std::cout << "Hopeless! cannot find 'reco' in [" << str_reco << "]" << std::endl;
throw ( BrukerHopelessException ("Hopeless! cannot find 'reco'"));
//exit(0); /// \TODO throw an exception !
- }
-
- else {
+ } else {
if (verbose)
std::cout << "[" << str_reco << "] successfully Loaded " << std::endl;
canOpen = br_reco.FillMap();
std::cout << "Hopeless! FillMap failed on [" << str_reco << "]" << std::endl;
throw ( BrukerHopelessException ("Hopeless! FillMap failed on 'reco'"));
- }
- else {
+ } else {
if (verbose)
std::cout << "[" << str_reco << "] successfully Mapped" << std::endl;
}
- }
+ }
//std::cout << "------------------------------------------------------------------------------------------------" << std::cout;
// br_reco.PrintSelf();
VALID_FILE_SEPARATOR, "MhdFiles");
std::string temp(currentOutputMhdDirName);
boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(currentOutputMhdDirName, "%s", temp);
+ sprintf(currentOutputMhdDirName, "%s", temp.c_str());
std::string strCurrentOutputMhdDirName(currentOutputMhdDirName);
res = CreateDirectory( strCurrentOutputMhdDirName );
if (!res) {
sprintf( original2dseqName, "%s%c%s", level3Directory.c_str(),VALID_FILE_SEPARATOR, "2dseq");
temp = level3Directory + VALID_FILE_SEPARATOR + "2dseq" ;
boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(original2dseqName, "%s", temp);
+ sprintf(original2dseqName, "%s", temp.c_str());
/**/
// \TODO : tenir compte du bazar precedent
// load 2dseq in memory
-
+
fp = fopen(temp.c_str(), "rb");
if (!fp)
{
// try 2dseq_Angio2D ?!?
temp = original2dseqName_XXX;
sprintf( original2dseqName_XXX, "%s%s", original2dseqName, "_Angio2D");
- sprintf(original2dseqName_XXX, "%s", temp);
+ sprintf(original2dseqName_XXX, "%s", temp.c_str());
fp = fopen(original2dseqName_XXX, "rb");
if (!fp)
{
serieNumber++;
gdcm::UIDGenerator uid;
strSerieUID = uid.Generate();
-
+
if (nbInstants==1) // creer un seul fichier .mhd pour toutes les Slices! (images natives)
{
if (verbose)
{
sprintf(outputMhdFileName, "%s%cMhdData_All_the_Slices.mhd", currentOutputMhdDirName,
VALID_FILE_SEPARATOR);
- temp = currentOutputDirName + VALID_FILE_SEPARATOR + "MhdFiles" + VALID_FILE_SEPARATOR +"MhdData_All_the_Slices.mhd";
+ temp = currentOutputDirName + VALID_FILE_SEPARATOR + "MhdFiles" + VALID_FILE_SEPARATOR +"MhdData_All_the_Slices.mhd";
boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(outputMhdFileName,"%s", temp);
+ sprintf(outputMhdFileName,"%s", temp.c_str());
fp=fopen(temp.c_str(), "w");
if (!fp)
{
currentOutputDirName.c_str(), VALID_FILE_SEPARATOR);
temp = currentOutputDirName + VALID_FILE_SEPARATOR + "2dseq_All_the_Slices";
boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(output2dseqSliceFileName,"%s",temp);
+ sprintf(output2dseqSliceFileName,"%s",temp.c_str());
fp=fopen(temp.c_str(), "wb");
if (!fp)
{
fclose(fp);
serieNumber ++;
gdcm::UIDGenerator uid;
- strSerieUID = uid.Generate();
-
+ strSerieUID = uid.Generate();
} // end if mhd
if (dicom)
{
VALID_FILE_SEPARATOR);
temp = currentOutputDirName + VALID_FILE_SEPARATOR + "2dseq_All_the_Slices.dcm";
boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(output2dseqSliceFileName, "%s", temp);
+ sprintf(output2dseqSliceFileName, "%s", temp.c_str());
/* ----------- Write Dicom Image ---------------*/
MakeDicomImage(buffer_2dseq,
VALID_FILE_SEPARATOR, k );
temp = outputMhdFileName;
boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(outputMhdFileName, "%s", temp);
+ sprintf(outputMhdFileName, "%s", temp.c_str());
if (verbose)
std::cout << "--- Output MHD file [" << outputMhdFileName << "]" << std::endl;
fp=fopen(outputMhdFileName, "w");
currentOutputDirName.c_str(), VALID_FILE_SEPARATOR,sliceNb);
temp = output2dseqSliceFileName;
boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(output2dseqSliceFileName, "%s", temp);
+ sprintf(output2dseqSliceFileName, "%s", temp.c_str());
fp=fopen(output2dseqSliceFileName, "wb");
if (!fp)
{
currentOutputDirName.c_str(), VALID_FILE_SEPARATOR, sliceNb);
temp= output2dseqSliceFileName;
boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(output2dseqSliceFileName, "%s", temp);
+ sprintf(output2dseqSliceFileName, "%s", temp.c_str());
MakeDicomImage(
pixelsForCurrentSlice,
sprintf(copyFile, "cp %s %s%c%s", (*it).c_str() ,
currentOutputDirName.c_str(), VALID_FILE_SEPARATOR, lastFileName.c_str());
std::string temp(copyFile);
- boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(copyFile, "%s", temp);
-
+ boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
+ sprintf(copyFile, "%s", temp.c_str());
+
system(copyFile);
sprintf(outputMhdFileName, "%s%c%s%s",
currentOutputDirName.c_str(),VALID_FILE_SEPARATOR, lastFileName.c_str(), ".mhd" );
temp = outputMhdFileName;
- boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(outputMhdFileName, "%s", temp);
-
+ boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
+ sprintf(outputMhdFileName, "%s", temp.c_str());
+
if (verbose)
std::cout << "--- Output Carto MHD file [" << outputMhdFileName << "]" << std::endl;
{
sprintf(output2dseqCartoName, "%s%c%s%s",
currentOutputDirName.c_str(), VALID_FILE_SEPARATOR, lastFileName.c_str(), ".dcm" );
-
+
std::string temp(output2dseqCartoName);
boost::algorithm::replace_all( temp, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
- sprintf(output2dseqCartoName,"%s", temp);
-
+ sprintf(output2dseqCartoName,"%s", temp.c_str());
+
if (verbose)
std::cout << "--- end create name output2dseqCartoName file [" << output2dseqCartoName << "]" << std::endl;
gdcm::UIDGenerator uid;
strSerieUID = uid.Generate();
-
+
gdcm::Filename file( (*it).c_str() );
- std::string strNewSerieDescr(strSerieDescr+ "_" + file.GetName());
+ std::string strNewSerieDescr(strSerieDescr+ "_" + file.GetName());
MakeDicomImage(buffer_carto,
NX,
NY,
{
gdcm::Directory dirList;
dirList.Load(userDirName); // DON'T get recursively the list of files
-
+
gdcm::Directory::FilenamesType fileNames;
fileNames = dirList.GetFilenames();
acqpFound= true; // user passes a 'serie', not a 'study'
else
acqpFound = false; // user passed a 'non study' directory; Hope it's a 'set of studies' directory!
-
+
int type;
if (subjectFound ) type = 1; // user passed a 'study
else if (acqpFound) type = 2; // user passed a 'serie'
l--;
s = s.substr(0, l);
}
-
+
if (s[0] == '<')
s= s.substr(1,l-2);
- std::string repChar("_");
+ std::string repChar("_");
+ /// \TODO use boost::algorithm::replace_all(
////boost::algorithm::replace_all(
//GDCM_NAME_SPACE::Util::ReplaceSpecChar(s, repChar);
}
br_acqp.SetLoopStructure();
std::vector<int> tempVect = br_acqp.GetLoopStructure() ;
std::map<std::string, BrukerFieldData> map = br_acqp.GetBrukerHeaderMap();
-
+
bool result = br_acqp.ObjectVaryingProperties.init(map,tempVect);
if (result == false)
std::string &serieDescr,
std::string &strStudyTimeDate,
int imgNum,
- int contentType
+ int contentType
)
{
std::ostringstream str;
ds.Replace(at.GetAsDataElement());
}
- //file.SetDataSet( createDataSet(str.str(),0x0028,0x0011,"US"));
+ //file.SetDataSet( createDataSet(str.str(),0x0028,0x0011,"US"));
// Set the image size
str.str("");
str << X;
-
+
// file->InsertEntryString(str.str(),0x0028,0x0011,"US"); // Columns
str.str("");
str << Y;
at.SetValue(serieUID);
ds.Replace(at.GetAsDataElement());
}
- {
+ {
gdcm::Attribute< 0x0008,0x0020, gdcm::VR::DA> at;
at.SetValue(strStudyTimeDate.substr(10,11).c_str());
ds.Replace(at.GetAsDataElement());
// //8, 16, 32, 64 (for double ?)
str.str("");
- str << pixelSize*8;
+ str << pixelSize*8;
// file->InsertEntryString(str.str(),0x0028,0x0100,"US"); // Bits Allocated
// file->InsertEntryString(str.str(),0x0028,0x0101,"US"); // Bits Stored
- str.str("");
- str << pixelSize*8-1;
+ //str.str("");
+ //str << pixelSize*8-1;
// file->InsertEntryString(str.str(),0x0028,0x0102,"US"); // High Bit
// Set the pixel representation // 0/1 , 0=unsigned
// file->InsertEntryString("1",0x0028,0x0103, "US"); // Pixel Representation
-
+
// Set the samples per pixel // 1:Grey level, 3:RGB
// file->InsertEntryString("1",0x0028,0x0002, "US"); // Samples per Pixel
// 0028 0030 DS 2 Pixel Spacing
- str.str("");
- str << spacingX << "\\" << spacingY;
+ //str.str("");
+ //str << spacingX << "\\" << spacingY;
// file->InsertEntryString(str.str(),0x0028,0x0030, "DS"); // Pixel Spacing
-
+
// 0018 0050 DS 1 Slice Thickness
- str.str("");
- str << sliceDistance;
+ //str.str("");
+ //str << sliceDistance;
// file->InsertEntryString(str.str(),0x0018,0x0050, "DS");
-
+
// 0020 0011 IS 1 Series Number
- str.str("");
- str << serieNumber;
+ //str.str("");
+ //str << serieNumber;
// file->InsertEntryString(str.str(),0x0020,0x0011, "IS");
-
+
// 0020|0013 [IS] [Instance Number]
instanceNumber++;
- str.str("");
- str << instanceNumber;
+ //str.str("");
+ //str << instanceNumber;
// file->InsertEntryString(str.str(),0x0020,0x0013, "IS");
-
+
// 1.2.840.10008.5.1.4.1.1.4.1 : Enhanced MR Image Storage
- // file->InsertEntryString("1.2.840.10008.5.1.4.1.1.4.1" , 0x0002, 0x0002, "UI"); // [Media Storage SOP Class UID]
+ // file->InsertEntryString("1.2.840.10008.5.1.4.1.1.4.1" , 0x0002, 0x0002, "UI"); // [Media Storage SOP Class UID]
// file->InsertEntryString("1.2.840.10008.5.1.4.1.1.4.1" , 0x0008, 0x0016, "UI"); // [SOP Class UID]
// OK : MR is NOT multiframe, but I want just a quick an dirty solution
//
// file->InsertEntryString(studyUID, 0x0020, 0x000d, "UI");
// file->InsertEntryString(serieUID, 0x0020, 0x000e, "UI");
-//
+//
//// 0008 0020 DA 1 Study Date
//// 0008 0030 TM 1 Study Time
//
// file->InsertEntryString("MR",0x0008,0x0060, "CS");
//
// 0020 0037 DS 6 Image Orientation (Patient)
- char charImageOrientation[256];
+// char charImageOrientation[256];
/*
std::cout << "charImageOrientation " <<
{
gdcm::Attribute< 0x0020,0x0037, gdcm::VR::DS> at;
- at.SetValue( imageSet[imgNum].getRotationMatrixRPS2XYZ()[0][0], 0);
- at.SetValue( imageSet[imgNum].getRotationMatrixRPS2XYZ()[0][1], 1);
- at.SetValue( imageSet[imgNum].getRotationMatrixRPS2XYZ()[0][2], 2);
- at.SetValue( imageSet[imgNum].getRotationMatrixRPS2XYZ()[1][0], 3);
- at.SetValue( imageSet[imgNum].getRotationMatrixRPS2XYZ()[1][1], 4);
- at.SetValue( imageSet[imgNum].getRotationMatrixRPS2XYZ()[1][2], 4);
+ at.SetValue(imageSet[imgNum].getRotationMatrixRPS2XYZ()[0][0], 0);
+ at.SetValue(imageSet[imgNum].getRotationMatrixRPS2XYZ()[0][1], 1);
+ at.SetValue(imageSet[imgNum].getRotationMatrixRPS2XYZ()[0][2], 2);
+ at.SetValue(imageSet[imgNum].getRotationMatrixRPS2XYZ()[1][0], 3);
+ at.SetValue(imageSet[imgNum].getRotationMatrixRPS2XYZ()[1][1], 4);
+ at.SetValue(imageSet[imgNum].getRotationMatrixRPS2XYZ()[1][2], 4);
ds.Replace(at.GetAsDataElement());
}
// file->InsertEntryString(charImageOrientation,0x0020,0x0037, "DS");
imageSet[imgNum].getTranslationVectorRPS2XYZ()[0],
imageSet[imgNum].getTranslationVectorRPS2XYZ()[1],
imageSet[imgNum].getTranslationVectorRPS2XYZ()[2]);
-
+
//file->InsertEntryString(charImagePosition,0x0020,0x0032, "DS"); //0020 0032 DS 3 Image Position (Patient)
-
+
// 0020 0032 DS 3 Image Position (Patient)
{
gdcm::Attribute< 0x0020,0x0032,gdcm::VR::DS> at;
- at.SetValue( imageSet[imgNum].getTranslationVectorRPS2XYZ()[0], 0);
- at.SetValue( imageSet[imgNum].getTranslationVectorRPS2XYZ()[1], 1);
- at.SetValue(imageSet[imgNum].getTranslationVectorRPS2XYZ()[2], 2);
- ds.Replace(at.GetAsDataElement());
+ at.SetValue(imageSet[imgNum].getTranslationVectorRPS2XYZ()[0], 0);
+ at.SetValue(imageSet[imgNum].getTranslationVectorRPS2XYZ()[1], 1);
+ at.SetValue(imageSet[imgNum].getTranslationVectorRPS2XYZ()[2], 2);
+ ds.Replace(at.GetAsDataElement());
}
-
-
+
// Private creator
/*
-
+
0029|0010 [LO] [Private Creator] [CREATIS HEADER ]
0029|0011 [LO] [Private Creator] [CREATIS for BRUKER to DICOM]
0029|1031 [LO] [] [4.0.7571167 ]
//{
// gdcm::Attribute< 0x0029,0x0010, gdcm::VR::LO> at;
// at.SetValue(.SetValue( "CREATIS HEADER");
- // ds.Replace(at.GetAsDataElement());
+ // ds.Replace(at.GetAsDataElement());
//}
//{
- // gdcm::Attribute< 0x0029,0x0011, gdcm::VR::LO> at;
- // // at.SetValue( "CREATIS FOR BRUKER-TO-DICOM");
+ // gdcm::Attribute< 0x0029,0x0011, gdcm::VR::LO> at;
+ // // at.SetValue( "CREATIS FOR BRUKER-TO-DICOM");
// ds.Replace(at.GetAsDataElement());
//}
// file->InsertEntryString("CREATIS HEADER", 0x0029,0x0010, "LO");
- //file->InsertEntryString("CREATIS FOR BRUKER-TO-DICOM", 0x0029,0x0011, "LO");
-
+ // file->InsertEntryString("CREATIS FOR BRUKER-TO-DICOM", 0x0029,0x0011, "LO");
+
BrukerFieldData brf_method = br_method.GetFieldData("Method");
const std::vector<std::string> method = brf_method.GetStringValue();
// ds.Replace(at.GetAsDataElement());
//}
//file->InsertEntryString(method[0], 0x0029,0x0100, "LO");
-
+
std::cout << " method[" << method[0] << "]" << std::endl;
if (method[0] == "DtiEpi" || method[0] == "DtiStandard")
{
// const std::vector<int> NDiffDir = br_method.GetFieldData("PVM_DwNDiffDir").GetIntValue();
BrukerFieldData brf_NDiffDir = br_method.GetFieldData("PVM_DwNDiffDir");
const std::vector<int> NDiffDir = brf_NDiffDir.GetIntValue();
-
+
//const std::vector<int> NDiffExpEach = br_method.GetFieldData("PVM_DwNDiffExpEach").GetIntValue();
BrukerFieldData brf_NDiffExpEach = br_method.GetFieldData("PVM_DwNDiffExpEach");
const std::vector<int> NDiffExpEach =brf_NDiffExpEach.GetIntValue();
-
+
// const std::vector<int> AoImages = br_method.GetFieldData("PVM_DwAoImages").GetIntValue();
BrukerFieldData brf_AoImages = br_method.GetFieldData("PVM_DwAoImages");
const std::vector<int> AoImages = brf_AoImages.GetIntValue();
-
+
BrukerFieldData brf_DwBvalEach = br_method.GetFieldData("PVM_DwBvalEach");
const std::vector<double> DwBvalEach = brf_DwBvalEach.GetDoubleValue();
-
+
std::cout << "nb directions : " << NDiffDir[0] << " nb valeurs de b par direction : " << NDiffExpEach[0]
<< " nb images for b=0 : " << AoImages[0] << std::endl;
-
+
str.str("");
str << NDiffDir[0];
{
at.SetValue( DwBvalEach[i], i);
ds.Replace(at.GetAsDataElement());
}
- // file->InsertEntryString(str.str(),0x0029,0x0104,"DS"); // Valeurs de b
+ // file->InsertEntryString(str.str(),0x0029,0x0104,"DS"); // Valeurs de b
}
file.SetDataSet(ds);
// GDCM_NAME_SPACE::FileHelper *fileH;
// fileH = GDCM_NAME_SPACE::FileHelper::New(file);
-// fileH->SetContentType(contentType);
-//
+// fileH->SetContentType(contentType);
+//
// // cast is just to avoid warnings (*no* conversion is performed)
// //fileH->SetImageData((uint8_t *)img,int(maxX*maxY)*sizeof(uint16_t)); // troubles when maxX, mayY are *actually* float!
//
//const gdcm::DataSet Bruker2Dicom::createDataSet(const std::string &i_val,
-// const uint16_t &i_gr, const uint16_t &i_el,
-// const gdcm::VR &i_vr)
+// const uint16_t &i_gr, const uint16_t &i_el,
+// const gdcm::VR &i_vr)
//
//{
// gdcm::Attribute<i_gr, i_el> at;