Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
std::string strDirNamein(dirNamein);
GDCM_NAME_SPACE::DirList dirList(strDirNamein, true); // get recursively the list of files
std::string strDirNamein(dirNamein);
GDCM_NAME_SPACE::DirList dirList(strDirNamein, true); // get recursively the list of files
std::vector<std::string> tokensForFileName;
// For Siemens pb, we need Manufacturer's Model Name
std::vector<std::string> tokensForFileName;
// For Siemens pb, we need Manufacturer's Model Name
GDCM_NAME_SPACE::DirListType::iterator it1 = fileNames.begin();
f = GDCM_NAME_SPACE::File::New();
f->SetLoadMode(GDCM_NAME_SPACE::LD_ALL);
GDCM_NAME_SPACE::DirListType::iterator it1 = fileNames.begin();
f = GDCM_NAME_SPACE::File::New();
f->SetLoadMode(GDCM_NAME_SPACE::LD_ALL);
SortedFiles sf;
s->AddSeriesDetail(0x0010, 0x0010, false); // Patient's Name
// for Siemens TrioTim, don't deal with 'Series Instance UID'
SortedFiles sf;
s->AddSeriesDetail(0x0010, 0x0010, false); // Patient's Name
// for Siemens TrioTim, don't deal with 'Series Instance UID'
s->AddSeriesDetail(0x0020, 0x000e, false); // Series Instance UID
else
s->AddSeriesDetail(0x9999, 0x9999, false); // dirty trick to ignore 'Series Instance UID'
s->AddSeriesDetail(0x0020, 0x000e, false); // Series Instance UID
else
s->AddSeriesDetail(0x9999, 0x9999, false); // dirty trick to ignore 'Series Instance UID'
- s->AddSeriesDetail(0x0020, 0x0032, false); // Image Position (Patient)
- s->AddSeriesDetail(0x0018, 0x1060, true); // Trigger Time (true: convert to keep numerical order)
- s->AddSeriesDetail(0x0018, 0x1312, false); // In-plane Phase Encoding Direction
- s->AddSeriesDetail(0x0008, 0x103e, false); // Series Description (special Siemens ...)
+ s->AddSeriesDetail(0x0020, 0x0032, false); // Image Position (Patient)
+ s->AddSeriesDetail(0x0018, 0x1060, true); // Trigger Time (true: convert to keep numerical order)
+ s->AddSeriesDetail(0x0018, 0x1312, false); // In-plane Phase Encoding Direction
+ s->AddSeriesDetail(0x0008, 0x103e, false); // Series Description (special Siemens ...)
strSeriesNumber = f->GetEntryString(0x0020, 0x0011 );
seriesNumber = atoi( strSeriesNumber.c_str() );
for (j=0;j<nbSeriesToKeep; j++)
strSeriesNumber = f->GetEntryString(0x0020, 0x0011 );
seriesNumber = atoi( strSeriesNumber.c_str() );
for (j=0;j<nbSeriesToKeep; j++)
-
- if ( tokens[3] == GDCM_NAME_SPACE::GDCM_UNFOUND) // sometimes Trigger Time is not found. CreateUserDefinedFileIdentifier is not aware of the pb.
+
+ // sometimes Trigger Time is not found.
+ // CreateUserDefinedFileIdentifier is not aware of the pb.
+ // We use File name instead (hope it's significant)
+
+ if ( tokens[IND_TriggerTime] == GDCM_NAME_SPACE::GDCM_UNFOUND)
{
///this is a trick to build up a lexicographical compliant name :
/// eg : fich001.ima vs fich100.ima as opposed to fich1.ima vs fich100.ima
{
///this is a trick to build up a lexicographical compliant name :
/// eg : fich001.ima vs fich100.ima as opposed to fich1.ima vs fich100.ima
imageNum = atoi ( tokensForFileName[0].c_str() );
// probabely we could write something much more complicated using C++ !
sprintf (newName, "%s%06d%s", skel, imageNum, extent);
imageNum = atoi ( tokensForFileName[0].c_str() );
// probabely we could write something much more complicated using C++ !
sprintf (newName, "%s%06d%s", skel, imageNum, extent);
- userFileIdentifier = tokens[0] + token + tokens[1] + token + tokens[2] + token
- + tokens[3] + token + tokens[4] + token + tokens[5] + token + tokens[6] + token;
+ userFileIdentifier = tokens[IND_PatientName] + token + tokens[IND_SerieInstanceUID] + token + tokens[IND_ImagePosition] + token
+ + tokens[IND_TriggerTime] + token + tokens[IND_PhaseEncodingDirection] + token + tokens[IND_seriesDescription] + token
+ + tokens[IND_FileName] + token;
-
- currentPatientName = tokens[0];
- currentSerieInstanceUID = tokens[1];
- currentImagePosition = tokens[2];
- currentTriggerTime = tokens[3];
- currentPhaseEncodingDirection = tokens[4];
- seriesDescription = tokens[5]; // For Siemens pb
+
+ currentPatientName = tokens[IND_PatientName];
+ currentSerieInstanceUID = tokens[IND_SerieInstanceUID];
+ currentImagePosition = tokens[IND_ImagePosition];
+ currentTriggerTime = tokens[IND_TriggerTime];
+ currentPhaseEncodingDirection = tokens[IND_PhaseEncodingDirection];
+ seriesDescription = tokens[IND_seriesDescription]; // For Siemens pb
currentFile->InsertEntryString("0.\\0.\\0.",0x0020, 0x0032, "DS" );
}
currentFile->InsertEntryString("0.\\0.\\0.",0x0020, 0x0032, "DS" );
}
if ( currentFile->GetEntryString(0x0020,0x0037) == GDCM_NAME_SPACE::GDCM_UNFOUND &&
currentFile->GetEntryString(0x0020,0x0035) == GDCM_NAME_SPACE::GDCM_UNFOUND )
{
currentFile->InsertEntryString("1.\\0.\\0.\\0.\\1.\\0.",0x0020, 0x0037, "DS" );
}
if ( currentFile->GetEntryString(0x0020,0x0037) == GDCM_NAME_SPACE::GDCM_UNFOUND &&
currentFile->GetEntryString(0x0020,0x0035) == GDCM_NAME_SPACE::GDCM_UNFOUND )
{
currentFile->InsertEntryString("1.\\0.\\0.\\0.\\1.\\0.",0x0020, 0x0037, "DS" );
}
if (previousPatientName != currentPatientName)
{
if ( currentFile->GetEntryString(0x0020,0x000d) == GDCM_NAME_SPACE::GDCM_UNFOUND) // Study UID
if (previousPatientName != currentPatientName)
{
if ( currentFile->GetEntryString(0x0020,0x000d) == GDCM_NAME_SPACE::GDCM_UNFOUND) // Study UID
std::cout << "--- --- new Serie UID created" << std::endl;
defaultSerieUID = GDCM_NAME_SPACE::Util::CreateUniqueUID();
// currentFile->InsertEntryString(defaultSerieUID, 0x0020, 0x000e, "UI" );
std::cout << "--- --- new Serie UID created" << std::endl;
defaultSerieUID = GDCM_NAME_SPACE::Util::CreateUniqueUID();
// currentFile->InsertEntryString(defaultSerieUID, 0x0020, 0x000e, "UI" );
std::cout << "==== === === === new PhaseEncodingDirection ["
<< currentPhaseEncodingDirection << "]" << std::endl;
std::cout << "==== === === === new PhaseEncodingDirection ["
<< currentPhaseEncodingDirection << "]" << std::endl;
+ GDCM_NAME_SPACE::GDCM_FILESEPARATOR
+ currentPhaseEncodingDirection;
systemCommand = "mkdir " + currentPhaseEncodingDirectionWriteDir;
+ GDCM_NAME_SPACE::GDCM_FILESEPARATOR
+ currentPhaseEncodingDirection;
systemCommand = "mkdir " + currentPhaseEncodingDirectionWriteDir;
if ( GDCM_NAME_SPACE::Debug::GetDebugFlag())
std::cout << "--- --- --- --- --- " << it2->first << " "
if ( GDCM_NAME_SPACE::Debug::GetDebugFlag())
std::cout << "--- --- --- --- --- " << it2->first << " "