br_method.FillMap();
/* a recuperer :
- ##$PVM_Fov (dimension)
+ ##$PVM_Fov (dimension) // ou plutot RECO_fov !
*/
/*
dans method (pour perfusion seulement?) :
std::string mhdDataPixelType;
int pixelSize;
getImhDataType(bDPT, mhdDataPixelType, pixelSize);
-
+
+
+ /*
+
+ // See mail Denis :
+ // En regle generale il vaut mieux que l'on passe par RECO_*
+ // pour extraire les parametres de l'image
+ //
+
BrukerFieldData fov = br_method.GetFieldData("PVM_Fov");
double fovX = fov.GetDoubleValue()[0];
double fovY = fov.GetDoubleValue()[1];
if (verbose)
std::cout << "FOV (ds method) " << fovX << " " << fovY << std::endl;
-
+
BrukerFieldData spatResol = br_method.GetFieldData("PVM_SpatResol");
double spatResolX = spatResol.GetDoubleValue()[0];
double spatResolY = spatResol.GetDoubleValue()[1];
if (verbose)
std::cout << "SpatResol (ds method) " << spatResolX << " " << spatResolY << std::endl;
+*/
+
+// Better we use 'get' accessors from BrukerImage class, as Denis wrote them
+
+ 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;
+
+ BrukerFieldData spatResol = br_reco.GetFieldData("PVM_SpatResol");
+ double spatResolX = spatResol.GetDoubleValue()[0];
+ double spatResolY = spatResol.GetDoubleValue()[1];
+ if (verbose)
+ std::cout << "SpatResol (ds method) " << spatResolX << " " << spatResolY << std::endl;
/// \TODO probabely a more sophisticated accessor will be necessary :
/// (cf : non contiguous slices, overlapping, slice thickness, space between slices, etc)
//exit (0);
}
}
-
+
unsigned char *buffer_2dseq = new unsigned char[NX*NY*pixelSize*nbSlices*nbInstants];
///\ TODO : find a safer way to be sure to read everything!
size_t lgr = fread(buffer_2dseq, 1, NX*NY*pixelSize*nbSlices*nbInstants, fp);
//return;
throw (e);
}
-
+
serieNumber++;
strSerieUID = GDCM_NAME_SPACE::Util::CreateUniqueUID();
if (nbInstants==1) // creer un seul fichier .mhd pour toutes les Slices! (images natives)
{
sprintf(output2dseqSliceFileName, "%s%c2dseq_All_the_Slices.dcm",
currentOutputDirName.c_str(), GDCM_NAME_SPACE::GDCM_FILESEPARATOR);
-
+
/* ----------- Write Dicom Image ---------------*/
MakeDicomImage(buffer_2dseq,
NX,
);
} // end if dicom
} // end if nbInstants = 1
-
+
else // more than ONE instant
{
// Interleaved !
} // end nbInstants == 1
delete [] buffer_2dseq;
/**/
-
-
+
+
// -----------------------------------------------------
// deal with MatLab-generated Carto file.
// -----------------------------------------------------
-
+
dealWithCarto(fileNames, NX, NY, nbSlices, /*fovX, fovY,*/ spatResolX, spatResolY, sliceDistance,
copyFile, currentOutputDirName, outputMhdFileName, output2dseqCartoName);
}
GDCM_NAME_SPACE::DirListType::iterator it;
char file_name_ident[500];
FILE *fp;
-
+
// Iterate to ALL the objets(files/directories) found in the input directory
for (it = fileNames.begin();
it != fileNames.end();
if ( loc != std::string::npos )
{
-
+
///\ TODO : find a safer way to be sure to read everything!
unsigned char *buffer_carto = new unsigned char[NX*NY*sizeof(double)*nbSlices];
fp = fopen ( (*it).c_str(), "rb");
currentOutputDirName.c_str(),GDCM_NAME_SPACE::GDCM_FILESEPARATOR, lastFileName.c_str(), ".mhd" );
if (verbose)
std::cout << "--- Output Carto MHD file [" << outputMhdFileName << "]" << std::endl;
-
+
FILE *fp;
fp=fopen(outputMhdFileName, "w");
if (!fp)