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
* according to their Patient/Study/Serie/Image characteristics
* - fills a single level Directory with *all* the files,
* converted into a Brucker-like Dicom, Intags compliant
* according to their Patient/Study/Serie/Image characteristics
* - fills a single level Directory with *all* the files,
* converted into a Brucker-like Dicom, Intags compliant
" - explores recursively the given directory, ",
" - keeps the requested series/ drops the unrequested series ",
" - orders the gdcm-readable found Files according to their ",
" - explores recursively the given directory, ",
" - keeps the requested series/ drops the unrequested series ",
" - orders the gdcm-readable found Files according to their ",
" 0x0021, 0x1040 : 'FRAME INDEX' ",
" 0x0020, 0x0012 : 'SESSION INDEX' (Acquisition Number) ",
" usage: ",
" 0x0021, 0x1040 : 'FRAME INDEX' ",
" 0x0020, 0x0012 : 'SESSION INDEX' (Acquisition Number) ",
" usage: ",
" dirout=outputDirectoryName ",
" { [keep= list of seriesNumber to process] ",
" | [drop= list of seriesNumber to ignore] } ",
" dirout=outputDirectoryName ",
" { [keep= list of seriesNumber to process] ",
" | [drop= list of seriesNumber to ignore] } ",
// ----- Initialize Arguments Manager ------
gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
// ----- Initialize Arguments Manager ------
gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
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(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
std::string fullFilename, lastFilename;
std::string previousPatientName, currentPatientName;
std::string fullFilename, lastFilename;
std::string previousPatientName, currentPatientName;
std::string previousImagePosition, currentImagePosition;
std::string previousPhaseEncodingDirection, currentPhaseEncodingDirection;
std::string previousTriggerTime, currentTriggerTime;
std::string previousImagePosition, currentImagePosition;
std::string previousPhaseEncodingDirection, currentPhaseEncodingDirection;
std::string previousTriggerTime, currentTriggerTime;
std::string writeDir, currentWriteDir;
std::string currentPatientWriteDir, currentSerieWriteDir,
std::string writeDir, currentWriteDir;
std::string currentPatientWriteDir, currentSerieWriteDir,
+ {
+ if ( currentFile->GetEntryString(0x0020,0x000d) == gdcm::GDCM_UNFOUND)
+ {
+ if (verbose)
+ std::cout << "--- new Study UID created" << std::endl;
+ defaultStudyUID = gdcm::Util::CreateUniqueUID();
+ currentFile->InsertEntryString(defaultStudyUID, 0x0020, 0x000d, "UI" );
+ }
+
previousPatientName = currentPatientName;
if (verbose)
std::cout << "==== new Patient [" << currentPatientName << "]" << std::endl;
previousPatientName = currentPatientName;
if (verbose)
std::cout << "==== new Patient [" << currentPatientName << "]" << std::endl;
+
+ if ( currentFile->GetEntryString(0x0020,0x000e) == gdcm::GDCM_UNFOUND)
+ {
+ if (verbose)
+ std::cout << "--- --- new Serie UID created" << std::endl;
+ defaultSerieUID = gdcm::Util::CreateUniqueUID();
+ currentFile->InsertEntryString(defaultSerieUID, 0x0020, 0x000e, "UI" );
+ }
+
currentFile->InsertEntryString(chSessionIndex, 0x0020, 0x0012, " ");
currentFile->InsertEntryString(chSessionIndex, 0x0020, 0x0012, " ");
currentFile->InsertEntryString(chSessionIndex, 0x0020, 0x0012, "IS");
// Deal with 0x0021, 0x1020 : 'SLICE INDEX'
currentFile->InsertEntryString(chSessionIndex, 0x0020, 0x0012, "IS");
// Deal with 0x0021, 0x1020 : 'SLICE INDEX'
currentFile->InsertEntryString(strChSliceIndex, 0x0021, 0x1020, stringVR);
currentFile->InsertEntryString(chFrameIndex, 0x0021, 0x1040, stringVR);
currentFile->InsertEntryString(strChSliceIndex, 0x0021, 0x1020, stringVR);
currentFile->InsertEntryString(chFrameIndex, 0x0021, 0x1040, stringVR);
+
+
+ std::string strImagePositionPatient = currentFile->GetEntryString(0x0020, 0x0032 );
+ if (strImagePositionPatient == gdcm::GDCM_UNFOUND)
+ {
+ if (verbose)
+ std::cout << "Duplicate ImagePosition into ImagePositionPatient" << std::endl;
+ currentFile->InsertEntryString(currentFile->GetEntryString(0x0020, 0x0030), 0x0020, 0x0032, "DS" );
+ }
+ std::string strImageOrientationPatient = f->GetEntryString(0x0020, 0x0037 );
+ if (strImageOrientationPatient == gdcm::GDCM_UNFOUND)
+ {
+ if (verbose)
+ std::cout << "Duplicate ImageOrientation into ImageOrientationPatient" << std::endl;
+ currentFile->InsertEntryString(currentFile->GetEntryString(0x0020, 0x0035), 0x0020, 0x0037, "DS" );
+ }
+
fh->SetWriteTypeToDcmExplVR();
// We didn't modify pixels -> keep unchanged the following :
// 'Media Storage SOP Class UID' (0x0002,0x0002)
// 'SOP Class UID' (0x0008,0x0016)
// 'Image Type' (0x0008,0x0008)
// 'Conversion Type' (0x0008,0x0064)
fh->SetWriteTypeToDcmExplVR();
// We didn't modify pixels -> keep unchanged the following :
// 'Media Storage SOP Class UID' (0x0002,0x0002)
// 'SOP Class UID' (0x0008,0x0016)
// 'Image Type' (0x0008,0x0008)
// 'Conversion Type' (0x0008,0x0064)
+
+ // Put to Black the burnt-in number.
+ nX = currentFile->GetXSize();
+ nY = currentFile->GetYSize();
+ for(int y=nY-15; y<nY; y++)
+ for(int x=nX/3; x<nX/2+50; x++)
+ imageData[ y*nX*2 + x ] = 0;
+