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
"usage: SplitIntoCoherentFileSetIgnoreSerieUID{dirin=inputDirectoryName} ",
" dirout=outputDirectoryName ",
" { tag=group-elem | pos | ori } [sort] ",
"usage: SplitIntoCoherentFileSetIgnoreSerieUID{dirin=inputDirectoryName} ",
" dirout=outputDirectoryName ",
" { tag=group-elem | pos | ori } [sort] ",
" [ { [noshadowseq] | [noshadow][noseq] } ] [debug] ",
" [studyUID = ] ",
" dirin : user wants to analyze *all* the files ",
" [ { [noshadowseq] | [noshadow][noseq] } ] [debug] ",
" [studyUID = ] ",
" dirin : user wants to analyze *all* the files ",
bool pos = ( 0 != am->ArgMgrDefined("pos") );
bool ori = ( 0 != am->ArgMgrDefined("ori") );
bool sort = ( 0 != am->ArgMgrDefined("sort") );
bool pos = ( 0 != am->ArgMgrDefined("pos") );
bool ori = ( 0 != am->ArgMgrDefined("ori") );
bool sort = ( 0 != am->ArgMgrDefined("sort") );
bool write = ( 0 != am->ArgMgrDefined("write") );
bool verbose = ( 0 != am->ArgMgrDefined("verbose") );
bool tag = ( 0 != am->ArgMgrDefined("tag") );
bool write = ( 0 != am->ArgMgrDefined("write") );
bool verbose = ( 0 != am->ArgMgrDefined("verbose") );
bool tag = ( 0 != am->ArgMgrDefined("tag") );
if( (tag && (pos || ori)) || (pos && (tag || ori)) || (ori && (tag || pos)) )
{
std::cout << " POS, ORI and TAG are mutually exclusive" << std::endl;
if( (tag && (pos || ori)) || (pos && (tag || ori)) || (ori && (tag || pos)) )
{
std::cout << " POS, ORI and TAG are mutually exclusive" << std::endl;
}
/* ===========================================================================================*/
std::string systemCommand;
}
/* ===========================================================================================*/
std::string systemCommand;
GDCM_NAME_SPACE::XCoherentFileSetmap xcm;
std::string serieUID;
std::string currentSerieWriteDir = "";
std::string xCoherentWriteDir = "";
GDCM_NAME_SPACE::XCoherentFileSetmap xcm;
std::string serieUID;
std::string currentSerieWriteDir = "";
std::string xCoherentWriteDir = "";
// 'Study Instance UID'
// The user is allowed to create his own Study,
// keeping the same 'Study Instance UID' for various images
// The user may add images to a 'Manufacturer Study',
// adding new Series to an already existing Study
std::string strStudyUID;
// 'Study Instance UID'
// The user is allowed to create his own Study,
// keeping the same 'Study Instance UID' for various images
// The user may add images to a 'Manufacturer Study',
// adding new Series to an already existing Study
std::string strStudyUID;
// Why not ? Just an example, for testing!
{
// Just not to make too many modif in the code
// Why not ? Just an example, for testing!
{
// Just not to make too many modif in the code
std:: cout << GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(groupelem[0],groupelem[1])->GetName() << std::endl;
xcm = s->SplitOnTagValue(l, groupelem[0],groupelem[1] );
}
std:: cout << GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(groupelem[0],groupelem[1])->GetName() << std::endl;
xcm = s->SplitOnTagValue(l, groupelem[0],groupelem[1] );
}
if (verbose)
std::cout << "xCoherentName = " << xCoherentName << std::endl;
GDCM_NAME_SPACE::Util::ReplaceSpecChar(xCoherentName, rep);
if (verbose)
std::cout << "xCoherentName = " << xCoherentName << std::endl;
GDCM_NAME_SPACE::Util::ReplaceSpecChar(xCoherentName, rep);
// OrderFileList() causes trouble, since some files
// (eg:MIP views) don't have 'Position', now considered as mandatory
// --> Activated on user demand.
// OrderFileList() causes trouble, since some files
// (eg:MIP views) don't have 'Position', now considered as mandatory
// --> Activated on user demand.
if (sort) {
s->OrderFileList((*i).second); // sort the XCoherent Fileset
std::cout << "ZSpacing for the file set " << s->GetZSpacing()
if (sort) {
s->OrderFileList((*i).second); // sort the XCoherent Fileset
std::cout << "ZSpacing for the file set " << s->GetZSpacing()
fh->SetKeepOverlays( true );
fh->InsertEntryString(strSerieUID,0x0020,0x000e,"UI");
unsigned int dataSize = fh->GetImageDataRawSize();
uint8_t *imageData = fh->GetImageDataRaw();// somewhat important : Loads the Pixels in memory !
if (!imageData)
fh->SetKeepOverlays( true );
fh->InsertEntryString(strSerieUID,0x0020,0x000e,"UI");
unsigned int dataSize = fh->GetImageDataRawSize();
uint8_t *imageData = fh->GetImageDataRaw();// somewhat important : Loads the Pixels in memory !
if (!imageData)
lastFilename = GDCM_NAME_SPACE::Util::GetName( fileName );
filenameout = xCoherentWriteDir + GDCM_NAME_SPACE::GDCM_FILESEPARATOR+ lastFilename;
//systemCommand = "cp " + fileName + " " + filenameout;
//system( systemCommand.c_str());
lastFilename = GDCM_NAME_SPACE::Util::GetName( fileName );
filenameout = xCoherentWriteDir + GDCM_NAME_SPACE::GDCM_FILESEPARATOR+ lastFilename;
//systemCommand = "cp " + fileName + " " + filenameout;
//system( systemCommand.c_str());
fh->SetWriteTypeToDcmExplVR();
fh->SetContentType(GDCM_NAME_SPACE::UNMODIFIED_PIXELS_IMAGE);
if (!fh->Write(filenameout))
{
std::cout << "Fail to write :[" << filenameout << "]"
<< std::endl;
fh->SetWriteTypeToDcmExplVR();
fh->SetContentType(GDCM_NAME_SPACE::UNMODIFIED_PIXELS_IMAGE);
if (!fh->Write(filenameout))
{
std::cout << "Fail to write :[" << filenameout << "]"
<< std::endl;