From 9ca0e4bb2208be93bebf21d0c5d75c8018e7605a Mon Sep 17 00:00:00 2001 From: jpr Date: Fri, 24 Jun 2005 10:55:58 +0000 Subject: [PATCH] Summer nights are really too hot to sleep. Coding style : kosherization of all the 'if's (300 amongst 900 were haram) --- src/gdcmContentEntry.cxx | 6 +-- src/gdcmDebug.cxx | 12 ++--- src/gdcmDicomDir.cxx | 94 +++++++++++++++++------------------ src/gdcmDicomDirElement.cxx | 18 +++---- src/gdcmDicomDirImage.cxx | 8 +-- src/gdcmDicomDirMeta.cxx | 6 +-- src/gdcmDicomDirPatient.cxx | 6 +-- src/gdcmDicomDirSerie.cxx | 6 +-- src/gdcmDicomDirStudy.cxx | 6 +-- src/gdcmDict.cxx | 12 ++--- src/gdcmDictEntry.cxx | 8 +-- src/gdcmDictGroupName.cxx | 10 ++-- src/gdcmDictSet.cxx | 10 ++-- src/gdcmDirList.cxx | 16 +++--- src/gdcmDocEntry.cxx | 6 +-- src/gdcmDocEntryArchive.cxx | 22 ++++---- src/gdcmDocEntrySet.cxx | 86 ++++++++++++++++---------------- src/gdcmElementSet.cxx | 10 ++-- src/gdcmException.cxx | 10 ++-- src/gdcmFileHelper.cxx | 62 +++++++++++------------ src/gdcmJpeg.cxx | 20 ++++---- src/gdcmMpeg.cxx | 66 ++++++++++++------------ src/gdcmPixelWriteConvert.cxx | 8 +-- src/gdcmSQItem.cxx | 12 ++--- src/gdcmSerieHelper.cxx | 22 ++++---- src/gdcmTS.cxx | 22 ++++---- src/gdcmUtil.cxx | 40 +++++++-------- src/gdcmVR.cxx | 8 +-- src/gdcmValEntry.cxx | 10 ++-- src/gdcmValidator.cxx | 8 +-- 30 files changed, 315 insertions(+), 315 deletions(-) diff --git a/src/gdcmContentEntry.cxx b/src/gdcmContentEntry.cxx index a7d57867..97c949e9 100644 --- a/src/gdcmContentEntry.cxx +++ b/src/gdcmContentEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmContentEntry.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:02:16 $ - Version: $Revision: 1.9 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -67,7 +67,7 @@ void ContentEntry::Copy(DocEntry *doc) DocEntry::Copy(doc); ContentEntry *entry = dynamic_cast(doc); - if(entry) + if ( entry ) Value = entry->Value; } diff --git a/src/gdcmDebug.cxx b/src/gdcmDebug.cxx index 541f79fc..d9a56182 100644 --- a/src/gdcmDebug.cxx +++ b/src/gdcmDebug.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDebug.cxx,v $ Language: C++ - Date: $Date: 2005/02/04 16:51:36 $ - Version: $Revision: 1.24 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.25 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -70,7 +70,7 @@ void Debug::SetDebugToFile (bool flag) } /** - * \brief Accessor to know if debug info are redirected to file + * \brief Accessor to know whether debug info are redirected to file */ bool Debug::GetDebugToFile () { @@ -79,7 +79,7 @@ bool Debug::GetDebugToFile () /** * \brief Set the filename the debug stream should be redirect to - * Settting a filename also set DebugToFile to true + * Settting a filename also sets DebugToFile to true * @param filename File to redirect debug info * Absolutely nothing is check. You have to pass in * a correct filename @@ -87,8 +87,8 @@ bool Debug::GetDebugToFile () void Debug::SetDebugFilename (std::string const &filename) { DebugToFile = true; // Just in case ... - DebugFlag = true; // Just in case ... - if( DebugFile.is_open() ) + DebugFlag = true; // Just in case ... + if ( DebugFile.is_open() ) DebugFile.close(); DebugFile.open( filename.c_str() ); } diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index 467f6394..a67ed04b 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/06/17 12:36:07 $ - Version: $Revision: 1.141 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.142 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -227,17 +227,17 @@ bool DicomDir::Load(std::string const &fileName ) */ bool DicomDir::IsReadable() { - if( Filetype == Unknown) + if ( Filetype == Unknown ) { gdcmWarningMacro( "Wrong filetype"); return false; } - if( !MetaElems ) + if ( !MetaElems ) { gdcmWarningMacro( "Meta Elements missing in DicomDir"); return false; } - if( Patients.size() <= 0 ) + if ( Patients.size() <= 0 ) { gdcmWarningMacro( "NO Patient in DicomDir"); return false; @@ -251,18 +251,18 @@ bool DicomDir::IsReadable() */ DicomDirMeta *DicomDir::NewMeta() { - if( MetaElems ) + if ( MetaElems ) delete MetaElems; DocEntry *entry = GetFirstEntry(); - if( entry ) + if ( entry ) { MetaElems = new DicomDirMeta(true); // true = empty entry = GetFirstEntry(); while( entry ) { - if( dynamic_cast(entry) ) + if ( dynamic_cast(entry) ) break; RemoveEntryNoDestroy(entry); @@ -351,7 +351,7 @@ void DicomDir::ParseDirectory() void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg, DicomDir::Method *argDelete ) { - if( StartArg && StartMethodArgDelete ) + if ( StartArg && StartMethodArgDelete ) { StartMethodArgDelete( StartArg ); } @@ -373,7 +373,7 @@ void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg, void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg, DicomDir::Method *argDelete ) { - if( ProgressArg && ProgressMethodArgDelete ) + if ( ProgressArg && ProgressMethodArgDelete ) { ProgressMethodArgDelete( ProgressArg ); } @@ -393,7 +393,7 @@ void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg, void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg, DicomDir::Method *argDelete ) { - if( EndArg && EndMethodArgDelete ) + if ( EndArg && EndMethodArgDelete ) { EndMethodArgDelete( EndArg ); } @@ -452,7 +452,7 @@ bool DicomDir::WriteDicomDir(std::string const &fileName) std::ofstream *fp = new std::ofstream(fileName.c_str(), std::ios::out | std::ios::binary); - if( !fp ) + if ( !fp ) { gdcmWarningMacro("Failed to open(write) File: " << fileName.c_str()); return false; @@ -552,7 +552,7 @@ void DicomDir::CreateDicomDirChainedList(std::string const &path) { Progress = (float)(count+1)/(float)fileList.size(); CallProgressMethod(); - if( Abort ) + if ( Abort ) { break; } @@ -561,13 +561,13 @@ void DicomDir::CreateDicomDirChainedList(std::string const &path) f->SetLoadMode(LoadMode); // we allow user not to load Sequences... f->Load( it->c_str() ); -// if( !f ) +// if ( !f ) // { // gdcmWarningMacro( "Failure in new gdcm::File " << it->c_str() ); // continue; // } - if( f->IsReadable() ) + if ( f->IsReadable() ) { // Add the file to the chained list: list.push_back(f); @@ -602,7 +602,7 @@ void DicomDir::CallStartMethod() { Progress = 0.0f; Abort = false; - if( StartMethod ) + if ( StartMethod ) { StartMethod( StartArg ); } @@ -613,7 +613,7 @@ void DicomDir::CallStartMethod() */ void DicomDir::CallProgressMethod() { - if( ProgressMethod ) + if ( ProgressMethod ) { ProgressMethod( ProgressArg ); } @@ -625,7 +625,7 @@ void DicomDir::CallProgressMethod() void DicomDir::CallEndMethod() { Progress = 1.0f; - if( EndMethod ) + if ( EndMethod ) { EndMethod( EndArg ); } @@ -702,40 +702,40 @@ void DicomDir::CreateDicomDir() continue; } - if( v == "PATIENT " ) + if ( v == "PATIENT " ) { si = new DicomDirPatient(true); - if( !AddPatientToEnd( static_cast(si)) ) + if ( !AddPatientToEnd( static_cast(si)) ) { delete si; si = NULL; gdcmErrorMacro( "Add PatientToEnd failed"); } } - else if( v == "STUDY " ) + else if ( v == "STUDY " ) { si = new DicomDirStudy(true); - if( !AddStudyToEnd( static_cast(si)) ) + if ( !AddStudyToEnd( static_cast(si)) ) { delete si; si = NULL; gdcmErrorMacro( "Add AddStudyToEnd failed"); } } - else if( v == "SERIES" ) + else if ( v == "SERIES" ) { si = new DicomDirSerie(true); - if( !AddSerieToEnd( static_cast(si)) ) + if ( !AddSerieToEnd( static_cast(si)) ) { delete si; si = NULL; gdcmErrorMacro( "Add AddSerieToEnd failed"); } } - else if( v == "IMAGE " ) + else if ( v == "IMAGE " ) { si = new DicomDirImage(true); - if( !AddImageToEnd( static_cast(si)) ) + if ( !AddImageToEnd( static_cast(si)) ) { delete si; si = NULL; @@ -748,7 +748,7 @@ void DicomDir::CreateDicomDir() // neither an 'IMAGE' SQItem. Skip to next item. continue; } - if( si ) + if ( si ) MoveSQItem(si,tmpSI); tmpSI=s->GetNextSQItem(); @@ -772,7 +772,7 @@ bool DicomDir::AddPatientToEnd(DicomDirPatient *dd) */ bool DicomDir::AddStudyToEnd(DicomDirStudy *dd) { - if( Patients.size() > 0 ) + if ( Patients.size() > 0 ) { ListDicomDirPatient::iterator itp = Patients.end(); itp--; @@ -788,13 +788,13 @@ bool DicomDir::AddStudyToEnd(DicomDirStudy *dd) */ bool DicomDir::AddSerieToEnd(DicomDirSerie *dd) { - if( Patients.size() > 0 ) + if ( Patients.size() > 0 ) { ListDicomDirPatient::iterator itp = Patients.end(); itp--; DicomDirStudy *study = (*itp)->GetLastStudy(); - if( study ) + if ( study ) { study->AddSerie(dd); return true; @@ -809,16 +809,16 @@ bool DicomDir::AddSerieToEnd(DicomDirSerie *dd) */ bool DicomDir::AddImageToEnd(DicomDirImage *dd) { - if( Patients.size() > 0 ) + if ( Patients.size() > 0 ) { ListDicomDirPatient::iterator itp = Patients.end(); itp--; DicomDirStudy *study = (*itp)->GetLastStudy(); - if( study ) + if ( study ) { DicomDirSerie *serie = study->GetLastSerie(); - if( serie ) + if ( serie ) { serie->AddImage(dd); return true; @@ -860,14 +860,14 @@ void DicomDir::SetElements(std::string const &path, VectDocument const &list) serCurInstanceUID = (*it)->GetEntryValue(0x0020,0x000e); serCurID = (*it)->GetEntryValue(0x0020,0x0011); - if( patCurName != patPrevName || patCurID != patPrevID || first ) + if ( patCurName != patPrevName || patCurID != patPrevID || first ) { SetElement(path, GDCM_DICOMDIR_PATIENT, *it); first = true; } // if new Study Deal with 'STUDY' Elements - if( studCurInstanceUID != studPrevInstanceUID || studCurID != studPrevID + if ( studCurInstanceUID != studPrevInstanceUID || studCurID != studPrevID || first ) { SetElement(path, GDCM_DICOMDIR_STUDY, *it); @@ -875,7 +875,7 @@ void DicomDir::SetElements(std::string const &path, VectDocument const &list) } // if new Serie Deal with 'SERIE' Elements - if( serCurInstanceUID != serPrevInstanceUID || serCurID != serPrevID + if ( serCurInstanceUID != serPrevInstanceUID || serCurID != serPrevID || first ) { SetElement(path, GDCM_DICOMDIR_SERIE, *it); @@ -918,7 +918,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, case GDCM_DICOMDIR_IMAGE: elemList = Global::GetDicomDirElements()->GetDicomDirImageElements(); si = new DicomDirImage(true); - if( !AddImageToEnd(static_cast(si)) ) + if ( !AddImageToEnd(static_cast(si)) ) { delete si; gdcmErrorMacro( "Add ImageToEnd failed"); @@ -927,7 +927,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, case GDCM_DICOMDIR_SERIE: elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements(); si = new DicomDirSerie(true); - if( !AddSerieToEnd(static_cast(si)) ) + if ( !AddSerieToEnd(static_cast(si)) ) { delete si; gdcmErrorMacro( "Add SerieToEnd failed"); @@ -936,7 +936,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, case GDCM_DICOMDIR_STUDY: elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements(); si = new DicomDirStudy(true); - if( !AddStudyToEnd(static_cast(si)) ) + if ( !AddStudyToEnd(static_cast(si)) ) { delete si; gdcmErrorMacro( "Add StudyToEnd failed"); @@ -945,7 +945,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, case GDCM_DICOMDIR_PATIENT: elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements(); si = new DicomDirPatient(true); - if( !AddPatientToEnd(static_cast(si)) ) + if ( !AddPatientToEnd(static_cast(si)) ) { delete si; gdcmErrorMacro( "Add PatientToEnd failed"); @@ -954,7 +954,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, case GDCM_DICOMDIR_META: elemList = Global::GetDicomDirElements()->GetDicomDirMetaElements(); si = new DicomDirMeta(true); - if( MetaElems ) + if ( MetaElems ) { delete MetaElems; gdcmErrorMacro( "MetaElements already exist, they will be destroyed"); @@ -985,7 +985,7 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, entry->SetOffset(0); // just to avoid further missprinting - if( header ) + if ( header ) { // NULL when we Build Up (ex nihilo) a DICOMDIR // or when we add the META elems @@ -996,16 +996,16 @@ void DicomDir::SetElement(std::string const &path, DicomDirType type, val = GDCM_UNFOUND; } - if( val == GDCM_UNFOUND) + if ( val == GDCM_UNFOUND) { - if( tmpGr == 0x0004 && tmpEl == 0x1130 ) // File-set ID + if ( tmpGr == 0x0004 && tmpEl == 0x1130 ) // File-set ID { // force to the *end* File Name val = Util::GetName( path ); } - else if( tmpGr == 0x0004 && tmpEl == 0x1500 ) // Only used for image + else if ( tmpGr == 0x0004 && tmpEl == 0x1500 ) // Only used for image { - if( header->GetFileName().substr(0, path.length()) != path ) + if ( header->GetFileName().substr(0, path.length()) != path ) { gdcmWarningMacro( "The base path of file name is incorrect"); val = header->GetFileName(); @@ -1073,7 +1073,7 @@ bool DicomDir::HeaderLessThan(Document *header1, Document *header2) */ void DicomDir::Print(std::ostream &os, std::string const & ) { - if( MetaElems ) + if ( MetaElems ) { MetaElems->SetPrintLevel(PrintLevel); MetaElems->Print(os); diff --git a/src/gdcmDicomDirElement.cxx b/src/gdcmDicomDirElement.cxx index f6f9004e..0545ddf3 100644 --- a/src/gdcmDicomDirElement.cxx +++ b/src/gdcmDicomDirElement.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirElement.cxx,v $ Language: C++ - Date: $Date: 2005/06/07 09:58:29 $ - Version: $Revision: 1.37 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.38 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -41,7 +41,7 @@ DicomDirElement::DicomDirElement() { std::string filename = DictSet::BuildDictPath() + DICT_ELEM; std::ifstream from(filename.c_str()); - if(!from) + if ( !from ) { gdcmWarningMacro( "Can't open DicomDirElement dictionary" << filename.c_str()); @@ -60,15 +60,15 @@ DicomDirElement::DicomDirElement() from.getline(buff, 1024, ' '); strType = buff; - if( strType == "metaElem" ) + if ( strType == "metaElem" ) type = DD_META; - else if( strType == "patientElem" ) + else if ( strType == "patientElem" ) type = DD_PATIENT; - else if( strType == "studyElem" ) + else if ( strType == "studyElem" ) type = DD_STUDY; - else if( strType == "serieElem" ) + else if ( strType == "serieElem" ) type = DD_SERIE; - else if( strType == "imageElem" ) + else if ( strType == "imageElem" ) type = DD_IMAGE; else { @@ -77,7 +77,7 @@ DicomDirElement::DicomDirElement() type = DD_UNKNOWN; } - if( type!=DD_UNKNOWN ) + if ( type!=DD_UNKNOWN ) { from >> std::hex >> elem.Group >> elem.Elem; diff --git a/src/gdcmDicomDirImage.cxx b/src/gdcmDicomDirImage.cxx index 8950538c..00728428 100644 --- a/src/gdcmDicomDirImage.cxx +++ b/src/gdcmDicomDirImage.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirImage.cxx,v $ Language: C++ - Date: $Date: 2005/02/01 10:29:55 $ - Version: $Revision: 1.22 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.23 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -31,7 +31,7 @@ namespace gdcm DicomDirImage::DicomDirImage(bool empty): DicomDirObject() { - if( !empty ) + if ( !empty ) { ListDicomDirImageElem const &elemList = Global::GetDicomDirElements()->GetDicomDirImageElements(); @@ -70,7 +70,7 @@ void DicomDirImage::Print(std::ostream &os, std::string const & ) i!= DocEntries.end(); ++i) { - if( (*i)->GetGroup() == 0x0004 && (*i)->GetElement() == 0x1500 ) + if ( (*i)->GetGroup() == 0x0004 && (*i)->GetElement() == 0x1500 ) { os << (dynamic_cast(*i))->GetValue(); //FIXME } diff --git a/src/gdcmDicomDirMeta.cxx b/src/gdcmDicomDirMeta.cxx index ec3d35b4..f680555b 100644 --- a/src/gdcmDicomDirMeta.cxx +++ b/src/gdcmDicomDirMeta.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirMeta.cxx,v $ Language: C++ - Date: $Date: 2005/02/01 10:29:55 $ - Version: $Revision: 1.27 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -31,7 +31,7 @@ namespace gdcm DicomDirMeta::DicomDirMeta(bool empty): DicomDirObject() { - if( !empty ) + if ( !empty ) { ListDicomDirStudyElem const &elemList = Global::GetDicomDirElements()->GetDicomDirMetaElements(); diff --git a/src/gdcmDicomDirPatient.cxx b/src/gdcmDicomDirPatient.cxx index 58ad1294..7c2b598d 100644 --- a/src/gdcmDicomDirPatient.cxx +++ b/src/gdcmDicomDirPatient.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirPatient.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:02:16 $ - Version: $Revision: 1.37 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.38 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -34,7 +34,7 @@ namespace gdcm DicomDirPatient::DicomDirPatient(bool empty) :DicomDirObject() { - if( !empty ) + if ( !empty ) { ListDicomDirStudyElem const &elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements(); diff --git a/src/gdcmDicomDirSerie.cxx b/src/gdcmDicomDirSerie.cxx index 16e7e4f2..db93cc01 100644 --- a/src/gdcmDicomDirSerie.cxx +++ b/src/gdcmDicomDirSerie.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirSerie.cxx,v $ Language: C++ - Date: $Date: 2005/02/01 10:29:55 $ - Version: $Revision: 1.37 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.38 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -33,7 +33,7 @@ namespace gdcm DicomDirSerie::DicomDirSerie(bool empty): DicomDirObject() { - if( !empty ) + if ( !empty ) { ListDicomDirSerieElem const &elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements(); diff --git a/src/gdcmDicomDirStudy.cxx b/src/gdcmDicomDirStudy.cxx index 5d30d595..4bb284ff 100644 --- a/src/gdcmDicomDirStudy.cxx +++ b/src/gdcmDicomDirStudy.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirStudy.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:02:16 $ - Version: $Revision: 1.36 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.37 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -33,7 +33,7 @@ namespace gdcm DicomDirStudy::DicomDirStudy(bool empty) :DicomDirObject() { - if( !empty ) + if ( !empty ) { ListDicomDirStudyElem const &elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements(); diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index 995c8508..0d219d9f 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDict.cxx,v $ Language: C++ - Date: $Date: 2005/06/02 12:26:42 $ - Version: $Revision: 1.76 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.77 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -54,7 +54,7 @@ Dict::Dict(std::string const &filename) TagName name; std::ifstream from( filename.c_str() ); - if( !from ) + if ( !from ) { gdcmWarningMacro( "Can't open dictionary" << filename.c_str()); // Using default embeded one: @@ -100,7 +100,7 @@ bool Dict::AddEntry(DictEntry const &newEntry) { const TagKey &key = newEntry.GetKey(); - if(KeyHt.count(key) == 1) + if ( KeyHt.count(key) == 1 ) { gdcmWarningMacro( "Already present" << key.c_str()); return false; @@ -136,7 +136,7 @@ bool Dict::ReplaceEntry(DictEntry const &newEntry) bool Dict::RemoveEntry(TagKey const &key) { TagKeyHT::const_iterator it = KeyHt.find(key); - if(it != KeyHt.end()) + if ( it != KeyHt.end() ) { KeyHt.erase(key); @@ -204,7 +204,7 @@ DictEntry *Dict::GetEntry(uint16_t group, uint16_t elem) DictEntry *Dict::GetFirstEntry() { ItKeyHt = KeyHt.begin(); - if( ItKeyHt != KeyHt.end() ) + if ( ItKeyHt != KeyHt.end() ) return &(ItKeyHt->second); return NULL; } diff --git a/src/gdcmDictEntry.cxx b/src/gdcmDictEntry.cxx index a56a454b..0c542ef7 100644 --- a/src/gdcmDictEntry.cxx +++ b/src/gdcmDictEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictEntry.cxx,v $ Language: C++ - Date: $Date: 2005/06/14 14:00:03 $ - Version: $Revision: 1.49 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.50 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -124,13 +124,13 @@ void DictEntry::Print(std::ostream &os, std::string const & ) std::ostringstream s; vr = GetVR(); - if(vr==GDCM_UNKNOWN) + if ( vr==GDCM_UNKNOWN ) vr=" "; s << DictEntry::TranslateToKey(GetGroup(),GetElement()); s << " [" << vr << "] "; - if (PrintLevel >= 1) + if ( PrintLevel >= 1 ) { s.setf(std::ios::left); s << std::setw(66-GetName().length()) << " "; diff --git a/src/gdcmDictGroupName.cxx b/src/gdcmDictGroupName.cxx index f714280c..15ae5cc3 100644 --- a/src/gdcmDictGroupName.cxx +++ b/src/gdcmDictGroupName.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictGroupName.cxx,v $ Language: C++ - Date: $Date: 2005/04/06 12:49:27 $ - Version: $Revision: 1.3 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -41,7 +41,7 @@ DictGroupName::DictGroupName() { std::string filename = DictSet::BuildDictPath() + DICT_GROUP_NAME; std::ifstream from(filename.c_str()); - if(!from) + if ( !from ) { gdcmWarningMacro("Can't open dictionary" << filename.c_str()); FillDefaultDictGroupName(groupName); @@ -61,7 +61,7 @@ DictGroupName::DictGroupName() from.getline(buff, 1024, '"'); from.getline(buff, 1024, '"'); value = buff; - if(!from.eof()) + if ( !from.eof() ) groupName[key] = value; from.getline(buff, 1024, '\n'); @@ -83,7 +83,7 @@ DictGroupName::~DictGroupName() const TagName &DictGroupName::GetName(uint16_t group) { DictGroupNameHT::const_iterator it = groupName.find(group); - if (it == groupName.end()) + if ( it == groupName.end() ) { return GDCM_UNFOUND; } diff --git a/src/gdcmDictSet.cxx b/src/gdcmDictSet.cxx index 3eede79d..646d3374 100644 --- a/src/gdcmDictSet.cxx +++ b/src/gdcmDictSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictSet.cxx,v $ Language: C++ - Date: $Date: 2005/06/14 18:37:55 $ - Version: $Revision: 1.64 $ + Date: $Date: 2005/06/24 10:55:58 $ + Version: $Revision: 1.65 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -88,7 +88,7 @@ Dict *DictSet::LoadDictFromFile(std::string const &filename, Dict *DictSet::GetDict(DictKey const &dictName) { DictSetHT::iterator dict = Dicts.find(dictName); - if(dict != Dicts.end()) + if ( dict != Dicts.end() ) { return dict->second; } @@ -124,7 +124,7 @@ DictEntry *DictSet::NewVirtualDictEntry( uint16_t group, TagKeyHT::iterator it; it = VirtualEntries.find(tag); - if(it != VirtualEntries.end()) + if ( it != VirtualEntries.end() ) { entry = &(it->second); } @@ -146,7 +146,7 @@ DictEntry *DictSet::NewVirtualDictEntry( uint16_t group, Dict *DictSet::GetFirstEntry() { ItDictHt = Dicts.begin(); - if( ItDictHt != Dicts.end() ) + if ( ItDictHt != Dicts.end() ) return ItDictHt->second; return NULL; } diff --git a/src/gdcmDirList.cxx b/src/gdcmDirList.cxx index 8b437783..be14a0d4 100644 --- a/src/gdcmDirList.cxx +++ b/src/gdcmDirList.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDirList.cxx,v $ Language: C++ - Date: $Date: 2005/05/11 14:40:57 $ - Version: $Revision: 1.50 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.51 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -64,7 +64,7 @@ bool DirList::IsDirectory(std::string const &dirName) { struct stat fs; assert( dirName[dirName.size()-1] != '/' ); - if(stat(dirName.c_str(), &fs) == 0) + if ( stat(dirName.c_str(), &fs) == 0 ) { #if _WIN32 return ((fs.st_mode & _S_IFDIR) != 0); @@ -102,10 +102,10 @@ int DirList::Explore(std::string const &dirpath, bool recursive) b = FindNextFile(hFile, &fileData)) { fileName = fileData.cFileName; - if( fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + if ( fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) { // Need to check for . and .. to avoid infinite loop - if( fileName != "." && fileName != ".." && recursive ) + if ( fileName != "." && fileName != ".." && recursive ) { numberOfFiles += Explore(dirName+fileName,recursive); } @@ -139,14 +139,14 @@ int DirList::Explore(std::string const &dirpath, bool recursive) { fileName = dirName + d->d_name; stat(fileName.c_str(), &buf); //really discard output ? - if( S_ISREG(buf.st_mode) ) //is it a regular file? + if ( S_ISREG(buf.st_mode) ) //is it a regular file? { Filenames.push_back( fileName ); numberOfFiles++; } - else if( S_ISDIR(buf.st_mode) ) //directory? + else if ( S_ISDIR(buf.st_mode) ) //directory? { - if( d->d_name[0] != '.' && recursive ) //we are also skipping hidden files + if ( d->d_name[0] != '.' && recursive ) //we are also skipping hidden files { numberOfFiles += Explore( fileName, recursive); } diff --git a/src/gdcmDocEntry.cxx b/src/gdcmDocEntry.cxx index c1ac5508..488b062a 100644 --- a/src/gdcmDocEntry.cxx +++ b/src/gdcmDocEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntry.cxx,v $ Language: C++ - Date: $Date: 2005/06/14 14:00:04 $ - Version: $Revision: 1.58 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.59 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -220,7 +220,7 @@ void DocEntry::Print(std::ostream &os, std::string const & ) o = GetOffset(); vr = GetVR(); - if(vr==GDCM_UNKNOWN) + if ( vr==GDCM_UNKNOWN ) vr=" "; s << DictEntry::TranslateToKey(GetGroup(),GetElement()); diff --git a/src/gdcmDocEntryArchive.cxx b/src/gdcmDocEntryArchive.cxx index 43b02739..913c3100 100644 --- a/src/gdcmDocEntryArchive.cxx +++ b/src/gdcmDocEntryArchive.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntryArchive.cxx,v $ Language: C++ - Date: $Date: 2005/05/24 09:14:09 $ - Version: $Revision: 1.14 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -53,19 +53,19 @@ DocEntryArchive::~DocEntryArchive() */ bool DocEntryArchive::Push(DocEntry *newEntry) { - if(!newEntry) + if ( !newEntry ) return false; uint16_t group = newEntry->GetDictEntry()->GetGroup(); uint16_t elem = newEntry->GetDictEntry()->GetElement(); std::string key = DictEntry::TranslateToKey(group,elem); - if( Archive.find(key)==Archive.end() ) + if ( Archive.find(key)==Archive.end() ) { // Save the old DocEntry if any DocEntry *old = ArchFile->GetDocEntry(group, elem); Archive[key] = old; - if( old ) + if ( old ) ArchFile->RemoveEntryNoDestroy(old); // Set the new DocEntry @@ -88,12 +88,12 @@ bool DocEntryArchive::Push(uint16_t group, uint16_t elem) { std::string key = DictEntry::TranslateToKey(group, elem); - if( Archive.find(key)==Archive.end() ) + if ( Archive.find(key)==Archive.end() ) { // Save the old DocEntry if any DocEntry *old = ArchFile->GetDocEntry(group, elem); Archive[key] = old; - if( old ) + if ( old ) ArchFile->RemoveEntryNoDestroy(old); return true; @@ -114,15 +114,15 @@ bool DocEntryArchive::Restore(uint16_t group, uint16_t elem) std::string key=DictEntry::TranslateToKey(group, elem); TagDocEntryHT::iterator restoreIt=Archive.find(key); - if( restoreIt!=Archive.end() ) + if ( restoreIt!=Archive.end() ) { // Delete the new value DocEntry *rem = ArchFile->GetDocEntry(group, elem); - if( rem ) + if ( rem ) ArchFile->RemoveEntry(rem); // Restore the old value - if( Archive[key] ) + if ( Archive[key] ) ArchFile->AddEntry(Archive[key]); Archive.erase(restoreIt); @@ -166,7 +166,7 @@ void DocEntryArchive::Print(std::ostream &os) it!=Archive.end(); ++it) { - if(it->second) + if ( it->second ) it->second->Print(os); } } diff --git a/src/gdcmDocEntrySet.cxx b/src/gdcmDocEntrySet.cxx index d1856ef6..19b7d39d 100644 --- a/src/gdcmDocEntrySet.cxx +++ b/src/gdcmDocEntrySet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntrySet.cxx,v $ Language: C++ - Date: $Date: 2005/02/17 11:03:32 $ - Version: $Revision: 1.56 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.57 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -43,7 +43,7 @@ namespace gdcm std::string DocEntrySet::GetEntryValue(uint16_t group, uint16_t elem) { ContentEntry *entry = dynamic_cast(GetDocEntry(group,elem)); - if( entry ) + if ( entry ) return entry->GetValue(); return GDCM_UNFOUND; } @@ -57,7 +57,7 @@ std::string DocEntrySet::GetEntryValue(uint16_t group, uint16_t elem) void *DocEntrySet::GetEntryBinArea(uint16_t group, uint16_t elem) { BinEntry *entry = GetBinEntry(group, elem); - if( entry ) + if ( entry ) return entry->GetBinArea(); return 0; } @@ -73,7 +73,7 @@ void *DocEntrySet::GetEntryBinArea(uint16_t group, uint16_t elem) int DocEntrySet::GetEntryLength(uint16_t group, uint16_t elem) { DocEntry *entry = GetDocEntry(group, elem); - if( entry ) + if ( entry ) return entry->GetLength(); return -1; } @@ -94,7 +94,7 @@ int DocEntrySet::GetEntryLength(uint16_t group, uint16_t elem) std::string DocEntrySet::GetEntryVR(uint16_t group, uint16_t elem) { DocEntry *entry = GetDocEntry(group, elem); - if( entry ) + if ( entry ) return entry->GetVR(); return GDCM_UNFOUND; } @@ -210,7 +210,7 @@ bool DocEntrySet::SetBinEntry(uint8_t *content, int lgth, */ bool DocEntrySet::SetValEntry(std::string const &content, ValEntry *entry) { - if(entry) + if (entry) { entry->SetValue(content); return true; @@ -227,7 +227,7 @@ bool DocEntrySet::SetValEntry(std::string const &content, ValEntry *entry) */ bool DocEntrySet::SetBinEntry(uint8_t *content, int lgth, BinEntry *entry) { - if(entry) + if (entry) { entry->SetBinArea(content); entry->SetLength(lgth); @@ -259,14 +259,14 @@ ValEntry *DocEntrySet::InsertValEntry(std::string const &value, valEntry = dynamic_cast(currentEntry); // Verify the VR - if( valEntry ) - if( valEntry->GetVR()!=vr ) + if ( valEntry ) + if ( valEntry->GetVR()!=vr ) valEntry = NULL; // if currentEntry doesn't correspond to the requested valEntry - if( !valEntry) + if ( !valEntry) { - if( !RemoveEntry(currentEntry) ) + if ( !RemoveEntry(currentEntry) ) { gdcmWarningMacro( "Removal of previous DocEntry failed."); @@ -276,7 +276,7 @@ ValEntry *DocEntrySet::InsertValEntry(std::string const &value, } // Create a new valEntry if necessary - if( !valEntry ) + if ( !valEntry ) { valEntry = NewValEntry( group, elem, vr ); @@ -319,14 +319,14 @@ BinEntry *DocEntrySet::InsertBinEntry(uint8_t *binArea, int lgth, binEntry = dynamic_cast(currentEntry); // Verify the VR - if( binEntry ) - if( binEntry->GetVR()!=vr ) + if ( binEntry ) + if ( binEntry->GetVR()!=vr ) binEntry = NULL; // if currentEntry doesn't correspond to the requested valEntry - if( !binEntry) + if ( !binEntry) { - if( !RemoveEntry(currentEntry) ) + if ( !RemoveEntry(currentEntry) ) { gdcmWarningMacro( "Removal of previous DocEntry failed."); @@ -336,7 +336,7 @@ BinEntry *DocEntrySet::InsertBinEntry(uint8_t *binArea, int lgth, } // Create a new binEntry if necessary - if( !binEntry) + if ( !binEntry) { binEntry = NewBinEntry(group, elem, vr); @@ -351,7 +351,7 @@ BinEntry *DocEntrySet::InsertBinEntry(uint8_t *binArea, int lgth, // Set the binEntry value uint8_t *tmpArea; - if( lgth>0 && binArea ) + if ( lgth>0 && binArea ) { tmpArea = new uint8_t[lgth]; memcpy(tmpArea,binArea,lgth); @@ -360,9 +360,9 @@ BinEntry *DocEntrySet::InsertBinEntry(uint8_t *binArea, int lgth, { tmpArea = 0; } - if( !SetBinEntry(tmpArea,lgth,binEntry) ) + if ( !SetBinEntry(tmpArea,lgth,binEntry) ) { - if( tmpArea ) + if ( tmpArea ) { delete[] tmpArea; } @@ -385,16 +385,16 @@ SeqEntry *DocEntrySet::InsertSeqEntry(uint16_t group, uint16_t elem) DocEntry *currentEntry = GetDocEntry( group, elem ); // Verify the currentEntry - if( currentEntry ) + if ( currentEntry ) { seqEntry = dynamic_cast(currentEntry); // Verify the VR - if( seqEntry ) + if ( seqEntry ) seqEntry = NULL; // if currentEntry doesn't correspond to the requested seqEntry - if( !seqEntry ) + if ( !seqEntry ) { if (!RemoveEntry(currentEntry)) { @@ -405,11 +405,11 @@ SeqEntry *DocEntrySet::InsertSeqEntry(uint16_t group, uint16_t elem) } } // Create a new seqEntry if necessary - if( !seqEntry ) + if ( !seqEntry ) { seqEntry = NewSeqEntry(group, elem); - if( !AddEntry(seqEntry) ) + if ( !AddEntry(seqEntry) ) { gdcmWarningMacro( "AddEntry failed although this is a creation."); @@ -422,8 +422,6 @@ SeqEntry *DocEntrySet::InsertSeqEntry(uint16_t group, uint16_t elem) // in the SeqEntry, at the end. return seqEntry; } - - /** * \brief Checks if a given Dicom Element exists within the H table @@ -440,9 +438,9 @@ bool DocEntrySet::CheckIfEntryExist(uint16_t group, uint16_t elem ) * \brief Build a new Val Entry from all the low level arguments. * Check for existence of dictionary entry, and build * a default one when absent. - * @param group group number of the new Entry - * @param elem element number of the new Entry - * @param vr VR of the new Entry + * @param group Group number of the new Entry + * @param elem Element number of the new Entry + * @param vr V(alue) R(epresentation) of the new Entry */ ValEntry *DocEntrySet::NewValEntry(uint16_t group,uint16_t elem, TagName const &vr) @@ -464,9 +462,9 @@ ValEntry *DocEntrySet::NewValEntry(uint16_t group,uint16_t elem, * \brief Build a new Bin Entry from all the low level arguments. * Check for existence of dictionary entry, and build * a default one when absent. - * @param group group number of the new Entry - * @param elem element number of the new Entry - * @param vr VR of the new Entry + * @param group Group number of the new Entry + * @param elem Element number of the new Entry + * @param vr V(alue) R(epresentation) of the new Entry */ BinEntry *DocEntrySet::NewBinEntry(uint16_t group, uint16_t elem, TagName const &vr) @@ -487,8 +485,8 @@ BinEntry *DocEntrySet::NewBinEntry(uint16_t group, uint16_t elem, * \brief Build a new Seq Entry from all the low level arguments. * Check for existence of dictionary entry, and build * a default one when absent. - * @param group group number of the new Entry - * @param elem element number of the new Entry + * @param group Group number of the new Entry + * @param elem Element number of the new Entry */ SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group, uint16_t elem) { @@ -506,10 +504,10 @@ SeqEntry* DocEntrySet::NewSeqEntry(uint16_t group, uint16_t elem) /** * \brief Request a new virtual dict entry to the dict set - * @param group group number of the underlying DictEntry - * @param elem element number of the underlying DictEntry - * @param vr VR (Value Representation) of the underlying DictEntry - * @param vm VM (Value Multiplicity) of the underlying DictEntry + * @param group Group number of the underlying DictEntry + * @param elem Element number of the underlying DictEntry + * @param vr V(alue) R(epresentation) of the underlying DictEntry + * @param vm V(alue) M(ultiplicity) of the underlying DictEntry * @param name english name */ DictEntry* DocEntrySet::NewVirtualDictEntry( uint16_t group, uint16_t elem, @@ -526,9 +524,9 @@ DictEntry* DocEntrySet::NewVirtualDictEntry( uint16_t group, uint16_t elem, * \brief Searches [both] the public [and the shadow dictionary (when they * exist)] for the presence of the DictEntry with given * group and element. The public dictionary has precedence on the - * shadow one. - * @param group group number of the searched DictEntry - * @param elem element number of the searched DictEntry + * shadow one(s), if any. + * @param group Group number of the searched DictEntry + * @param elem Element number of the searched DictEntry * @return Corresponding DictEntry when it exists, NULL otherwise. */ DictEntry *DocEntrySet::GetDictEntry(uint16_t group,uint16_t elem) @@ -552,7 +550,7 @@ DictEntry *DocEntrySet::GetDictEntry(uint16_t group,uint16_t elem) * group and element, and create a new virtual DictEntry if necessary * @param group group number of the searched DictEntry * @param elem element number of the searched DictEntry - * @param vr Value Representation to use, if necessary + * @param vr V(alue) R(epresentation) to use, if necessary * @return Corresponding DictEntry when it exists, NULL otherwise. */ DictEntry *DocEntrySet::GetDictEntry(uint16_t group, uint16_t elem, diff --git a/src/gdcmElementSet.cxx b/src/gdcmElementSet.cxx index 2129c837..91c1b6d2 100644 --- a/src/gdcmElementSet.cxx +++ b/src/gdcmElementSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmElementSet.cxx,v $ Language: C++ - Date: $Date: 2005/02/07 08:48:18 $ - Version: $Revision: 1.58 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.59 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -70,7 +70,7 @@ bool ElementSet::AddEntry(DocEntry *newEntry) { const TagKey &key = newEntry->GetKey(); - if( TagHT.count(key) == 1 ) + if ( TagHT.count(key) == 1 ) { gdcmWarningMacro( "Key already present: " << key.c_str()); return false; @@ -89,7 +89,7 @@ bool ElementSet::AddEntry(DocEntry *newEntry) bool ElementSet::RemoveEntry( DocEntry *entryToRemove) { const TagKey &key = entryToRemove->GetKey(); - if( TagHT.count(key) == 1 ) + if ( TagHT.count(key) == 1 ) { TagHT.erase(key); //gdcmWarningMacro( "One element erased."); @@ -108,7 +108,7 @@ bool ElementSet::RemoveEntry( DocEntry *entryToRemove) bool ElementSet::RemoveEntryNoDestroy(DocEntry *entryToRemove) { const TagKey &key = entryToRemove->GetKey(); - if( TagHT.count(key) == 1 ) + if ( TagHT.count(key) == 1 ) { TagHT.erase(key); //gdcmWarningMacro( "One element erased."); diff --git a/src/gdcmException.cxx b/src/gdcmException.cxx index 698b7a60..8df23e07 100644 --- a/src/gdcmException.cxx +++ b/src/gdcmException.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmException.cxx,v $ Language: C++ - Date: $Date: 2005/02/01 10:29:55 $ - Version: $Revision: 1.26 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.27 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -84,7 +84,7 @@ std::string Exception::getName() const throw() std::string name; std::string iname = typeid(*this).name(); - if(iname[0] == 'Q') + if ( iname[0] == 'Q' ) { nested = iname[1] - '0'; iname = std::string(iname, 2, std::string::npos); @@ -94,8 +94,8 @@ std::string Exception::getName() const throw() ::sscanf(iname.c_str(), "%u%n", &nb, &offset); iname = std::string(iname, offset, std::string::npos); name += std::string(iname, 0, nb); - if(i + 1 < nested) name += "::"; - iname = std::string(iname, nb, std::string::npos); + if ( i + 1 < nested) name += "::"; + iname = std::string(iname, nb, std::string::npos ); } return name; #else // no class name demangling diff --git a/src/gdcmFileHelper.cxx b/src/gdcmFileHelper.cxx index 440fcb8d..0aeffd71 100644 --- a/src/gdcmFileHelper.cxx +++ b/src/gdcmFileHelper.cxx @@ -4,8 +4,8 @@ Module: $RCSfile: gdcmFileHelper.cxx,v $ Language: C++ - Date: $Date: 2005/06/22 07:53:52 $ - Version: $Revision: 1.45 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.46 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -172,20 +172,20 @@ FileHelper::FileHelper(std::string const &filename ) */ FileHelper::~FileHelper() { - if( PixelReadConverter ) + if ( PixelReadConverter ) { delete PixelReadConverter; } - if( PixelWriteConverter ) + if ( PixelWriteConverter ) { delete PixelWriteConverter; } - if( Archive ) + if ( Archive ) { delete Archive; } - if( SelfHeader ) + if ( SelfHeader ) { delete FileInternal; } @@ -538,7 +538,7 @@ bool FileHelper::WriteRawData(std::string const &fileName) return false; } - if( PixelWriteConverter->GetUserData() ) + if ( PixelWriteConverter->GetUserData() ) { fp1.write( (char *)PixelWriteConverter->GetUserData(), PixelWriteConverter->GetUserDataSize() ); @@ -655,7 +655,7 @@ bool FileHelper::Write(std::string const &fileName) /// \todo the best trick would be *change* the recognition code /// but pb expected if user deals with, e.g. COMPLEX images - if( WriteType == ACR_LIBIDO ) + if ( WriteType == ACR_LIBIDO ) { SetWriteToLibido(); } @@ -676,7 +676,7 @@ bool FileHelper::Write(std::string const &fileName) } bool check = CheckWriteIntegrity(); // verifies length - if(check) + if (check) { check = FileInternal->Write(fileName,WriteType); } @@ -708,7 +708,7 @@ bool FileHelper::Write(std::string const &fileName) */ bool FileHelper::CheckWriteIntegrity() { - if(PixelWriteConverter->GetUserData()) + if ( PixelWriteConverter->GetUserData() ) { int numberBitsAllocated = FileInternal->GetBitsAllocated(); if ( numberBitsAllocated == 0 || numberBitsAllocated == 12 ) @@ -725,13 +725,13 @@ bool FileHelper::CheckWriteIntegrity() * FileInternal->GetSamplesPerPixel() * ( numberBitsAllocated / 8 ); size_t rgbSize = decSize; - if( FileInternal->HasLUT() ) + if ( FileInternal->HasLUT() ) rgbSize = decSize * 3; switch(WriteMode) { case WMODE_RAW : - if( decSize!=PixelWriteConverter->GetUserDataSize() ) + if ( decSize!=PixelWriteConverter->GetUserDataSize() ) { gdcmWarningMacro( "Data size (Raw) is incorrect. Should be " << decSize << " / Found :" @@ -740,7 +740,7 @@ bool FileHelper::CheckWriteIntegrity() } break; case WMODE_RGB : - if( rgbSize!=PixelWriteConverter->GetUserDataSize() ) + if ( rgbSize!=PixelWriteConverter->GetUserDataSize() ) { gdcmWarningMacro( "Data size (RGB) is incorrect. Should be " << decSize << " / Found " @@ -760,15 +760,15 @@ bool FileHelper::CheckWriteIntegrity() */ void FileHelper::SetWriteToRaw() { - if( FileInternal->GetNumberOfScalarComponents() == 3 - && !FileInternal->HasLUT()) + if ( FileInternal->GetNumberOfScalarComponents() == 3 + && !FileInternal->HasLUT() ) { SetWriteToRGB(); } else { ValEntry *photInt = CopyValEntry(0x0028,0x0004); - if(FileInternal->HasLUT()) + if (FileInternal->HasLUT() ) { photInt->SetValue("PALETTE COLOR "); } @@ -781,9 +781,9 @@ void FileHelper::SetWriteToRaw() PixelReadConverter->GetRawSize()); std::string vr = "OB"; - if( FileInternal->GetBitsAllocated()>8 ) + if ( FileInternal->GetBitsAllocated()>8 ) vr = "OW"; - if( FileInternal->GetBitsAllocated()==24 ) // For RGB ACR files + if ( FileInternal->GetBitsAllocated()==24 ) // For RGB ACR files vr = "OB"; BinEntry *pixel = CopyBinEntry(GetFile()->GetGrPixel(),GetFile()->GetNumPixel(),vr); @@ -805,7 +805,7 @@ void FileHelper::SetWriteToRaw() */ void FileHelper::SetWriteToRGB() { - if(FileInternal->GetNumberOfScalarComponents()==3) + if ( FileInternal->GetNumberOfScalarComponents()==3 ) { PixelReadConverter->BuildRGBImage(); @@ -818,7 +818,7 @@ void FileHelper::SetWriteToRGB() ValEntry *photInt = CopyValEntry(0x0028,0x0004); photInt->SetValue("RGB "); - if(PixelReadConverter->GetRGB()) + if ( PixelReadConverter->GetRGB() ) { PixelWriteConverter->SetReadData(PixelReadConverter->GetRGB(), PixelReadConverter->GetRGBSize()); @@ -830,9 +830,9 @@ void FileHelper::SetWriteToRGB() } std::string vr = "OB"; - if( FileInternal->GetBitsAllocated()>8 ) + if ( FileInternal->GetBitsAllocated()>8 ) vr = "OW"; - if( FileInternal->GetBitsAllocated()==24 ) // For RGB ACR files + if ( FileInternal->GetBitsAllocated()==24 ) // For RGB ACR files vr = "OB"; BinEntry *pixel = CopyBinEntry(GetFile()->GetGrPixel(),GetFile()->GetNumPixel(),vr); @@ -859,7 +859,7 @@ void FileHelper::SetWriteToRGB() // For old '24 Bits' ACR-NEMA // Thus, we have a RGB image and the bits allocated = 24 and // samples per pixels = 1 (in the read file) - if(FileInternal->GetBitsAllocated()==24) + if ( FileInternal->GetBitsAllocated()==24 ) { ValEntry *bitsAlloc = CopyValEntry(0x0028,0x0100); bitsAlloc->SetValue("8 "); @@ -988,7 +988,7 @@ void FileHelper::SetWriteToLibido() ValEntry *oldCol = dynamic_cast (FileInternal->GetDocEntry(0x0028, 0x0011)); - if( oldRow && oldCol ) + if ( oldRow && oldCol ) { std::string rows, columns; @@ -1017,9 +1017,9 @@ void FileHelper::SetWriteToNoLibido() { ValEntry *recCode = dynamic_cast (FileInternal->GetDocEntry(0x0008,0x0010)); - if( recCode ) + if ( recCode ) { - if( recCode->GetValue() == "ACRNEMA_LIBIDO_1.1" ) + if ( recCode->GetValue() == "ACRNEMA_LIBIDO_1.1" ) { ValEntry *libidoCode = CopyValEntry(0x0008,0x0010); libidoCode->SetValue(""); @@ -1055,7 +1055,7 @@ ValEntry *FileHelper::CopyValEntry(uint16_t group, uint16_t elem) DocEntry *oldE = FileInternal->GetDocEntry(group, elem); ValEntry *newE; - if( oldE ) + if ( oldE ) { newE = new ValEntry(oldE->GetDictEntry()); newE->Copy(oldE); @@ -1082,11 +1082,11 @@ BinEntry *FileHelper::CopyBinEntry(uint16_t group, uint16_t elem, DocEntry *oldE = FileInternal->GetDocEntry(group, elem); BinEntry *newE; - if( oldE ) - if( oldE->GetVR()!=vr ) + if ( oldE ) + if ( oldE->GetVR()!=vr ) oldE = NULL; - if( oldE ) + if ( oldE ) { newE = new BinEntry(oldE->GetDictEntry()); newE->Copy(oldE); @@ -1499,7 +1499,7 @@ uint8_t *FileHelper::GetRaw() // The Raw image migth not be loaded yet: std::ifstream *fp = FileInternal->OpenFile(); PixelReadConverter->ReadAndDecompressPixelData( fp ); - if(fp) + if ( fp ) FileInternal->CloseFile(); raw = PixelReadConverter->GetRaw(); diff --git a/src/gdcmJpeg.cxx b/src/gdcmJpeg.cxx index 3d11de65..b98a9acf 100644 --- a/src/gdcmJpeg.cxx +++ b/src/gdcmJpeg.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmJpeg.cxx,v $ Language: C++ - Date: $Date: 2005/02/11 20:04:08 $ - Version: $Revision: 1.48 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.49 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -271,7 +271,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta return 0; } // Now we can initialize the JPEG decompression object. - if( statesuspension == 0 ) + if ( statesuspension == 0 ) { jpeg_create_decompress(&cinfo); jpeg_stdio_src(&cinfo, fp, this, 1); @@ -282,9 +282,9 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta } // Step 3: read file parameters with jpeg_read_header() - if( statesuspension < 2 ) + if ( statesuspension < 2 ) { - if( jpeg_read_header(&cinfo, TRUE) == JPEG_SUSPENDED ) + if ( jpeg_read_header(&cinfo, TRUE) == JPEG_SUSPENDED ) { // Suspension in jpeg_read_header statesuspension = 2; @@ -292,7 +292,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta // Step 4: set parameters for decompression // prevent the library from performing any color space conversion - if( cinfo.process == JPROC_LOSSLESS ) + if ( cinfo.process == JPROC_LOSSLESS ) { cinfo.jpeg_color_space = JCS_UNKNOWN; cinfo.out_color_space = JCS_UNKNOWN; @@ -300,9 +300,9 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta } // Step 5: Start decompressor - if(statesuspension < 3 ) + if (statesuspension < 3 ) { - if( jpeg_start_decompress(&cinfo) == FALSE ) + if ( jpeg_start_decompress(&cinfo) == FALSE ) { // Suspension: jpeg_start_decompress statesuspension = 3; @@ -330,7 +330,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta while (cinfo.output_scanline < cinfo.output_height) { - if( jpeg_read_scanlines(&cinfo, buffer, 1) == 0 ) + if ( jpeg_read_scanlines(&cinfo, buffer, 1) == 0 ) { // Suspension in jpeg_read_scanlines statesuspension = 3; @@ -349,7 +349,7 @@ bool JPEGFragment::ReadJPEGFile (std::ifstream *fp, void *image_buffer, int &sta } // Step 7: Finish decompression - if( jpeg_finish_decompress(&cinfo) == FALSE ) + if ( jpeg_finish_decompress(&cinfo) == FALSE ) { // Suspension: jpeg_finish_decompress statesuspension = 4; diff --git a/src/gdcmMpeg.cxx b/src/gdcmMpeg.cxx index fd05c73a..516f1bba 100644 --- a/src/gdcmMpeg.cxx +++ b/src/gdcmMpeg.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmMpeg.cxx,v $ Language: C++ - Date: $Date: 2005/06/02 12:32:55 $ - Version: $Revision: 1.4 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -42,7 +42,7 @@ static void Initialize_Decoder() int i; /* Clip table */ - if (!(Clip=(unsigned char *)malloc(1024))) + if ( !(Clip=(unsigned char *)malloc(1024)) ) Error("Clip[] malloc failed\n"); Clip += 384; @@ -51,7 +51,7 @@ static void Initialize_Decoder() Clip[i] = (i<0) ? 0 : ((i>255) ? 255 : i); /* IDCT */ - if (Reference_IDCT_Flag) + if ( Reference_IDCT_Flag ) Initialize_Reference_IDCT(); else Initialize_Fast_IDCT(); @@ -65,12 +65,15 @@ static void Initialize_Sequence() static int Table_6_20[3] = {6,8,12}; /* check scalability mode of enhancement layer */ - if (Two_Streams && (enhan.scalable_mode!=SC_SNR) && (base.scalable_mode!=SC_DP)) - Error("unsupported scalability mode\n"); - + if ( Two_Streams && (enhan.scalable_mode!=SC_SNR) + && + (base.scalable_mode!=SC_DP) ) + { + Error("unsupported scalability mode\n"); + } /* force MPEG-1 parameters for proper decoder behavior */ /* see ISO/IEC 13818-2 section D.9.14 */ - if (!base.MPEG2_Flag) + if ( !base.MPEG2_Flag ) { progressive_sequence = 1; progressive_frame = 1; @@ -100,39 +103,39 @@ static void Initialize_Sequence() for (cc=0; cc<3; cc++) { - if (cc==0) + if ( cc==0 ) size = Coded_Picture_Width*Coded_Picture_Height; else size = Chroma_Width*Chroma_Height; - if (!(backward_reference_frame[cc] = (unsigned char *)malloc(size))) + if ( !(backward_reference_frame[cc] = (unsigned char *)malloc(size)) ) Error("backward_reference_frame[] malloc failed\n"); - if (!(forward_reference_frame[cc] = (unsigned char *)malloc(size))) + if ( !(forward_reference_frame[cc] = (unsigned char *)malloc(size)) ) Error("forward_reference_frame[] malloc failed\n"); - if (!(auxframe[cc] = (unsigned char *)malloc(size))) + if ( !(auxframe[cc] = (unsigned char *)malloc(size)) ) Error("auxframe[] malloc failed\n"); - if(Ersatz_Flag) - if (!(substitute_frame[cc] = (unsigned char *)malloc(size))) + if ( Ersatz_Flag ) + if ( !(substitute_frame[cc] = (unsigned char *)malloc(size)) ) Error("substitute_frame[] malloc failed\n"); - if (base.scalable_mode==SC_SPAT) + if ( base.scalable_mode==SC_SPAT ) { /* this assumes lower layer is 4:2:0 */ - if (!(llframe0[cc] = (unsigned char *)malloc((lower_layer_prediction_horizontal_size*lower_layer_prediction_vertical_size)/(cc?4:1)))) + if ( !(llframe0[cc] = (unsigned char *)malloc((lower_layer_prediction_horizontal_size*lower_layer_prediction_vertical_size)/(cc?4:1)))) Error("llframe0 malloc failed\n"); - if (!(llframe1[cc] = (unsigned char *)malloc((lower_layer_prediction_horizontal_size*lower_layer_prediction_vertical_size)/(cc?4:1)))) + if ( !(llframe1[cc] = (unsigned char *)malloc((lower_layer_prediction_horizontal_size*lower_layer_prediction_vertical_size)/(cc?4:1)))) Error("llframe1 malloc failed\n"); } } /* SCALABILITY: Spatial */ - if (base.scalable_mode==SC_SPAT) + if ( base.scalable_mode==SC_SPAT ) { - if (!(lltmp = (short *)malloc(lower_layer_prediction_horizontal_size*((lower_layer_prediction_vertical_size*vertical_subsampling_factor_n)/vertical_subsampling_factor_m)*sizeof(short)))) + if ( !(lltmp = (short *)malloc(lower_layer_prediction_horizontal_size*((lower_layer_prediction_vertical_size*vertical_subsampling_factor_n)/vertical_subsampling_factor_m)*sizeof(short)))) Error("lltmp malloc failed\n"); } @@ -166,7 +169,6 @@ static int Headers() ld = &base; - /* return when end of sequence (0) or picture header has been parsed (1) */ @@ -202,7 +204,7 @@ static int Decode_Bitstream() ret = Headers(); - if(ret==1) + if ( ret==1 ) { ret = video_sequence(&Bitstream_Framenum); } @@ -226,18 +228,18 @@ static void Deinitialize_Sequence() free(forward_reference_frame[i]); free(auxframe[i]); - if (base.scalable_mode==SC_SPAT) + if ( base.scalable_mode==SC_SPAT ) { free(llframe0[i]); free(llframe1[i]); } } - if (base.scalable_mode==SC_SPAT) + if ( base.scalable_mode==SC_SPAT ) free(lltmp); #ifdef DISPLAY - if (Output_Type==T_X11) + if ( Output_Type==T_X11 ) Terminate_Display_Process(); #endif } @@ -261,7 +263,7 @@ static int video_sequence(int *Bitstream_Framenumber) Decode_Picture(Bitstream_Framenum, Sequence_Framenum); /* update picture numbers */ - if (!Second_Field) + if ( !Second_Field ) { Bitstream_Framenum++; Sequence_Framenum++; @@ -272,7 +274,7 @@ static int video_sequence(int *Bitstream_Framenumber) { Decode_Picture(Bitstream_Framenum, Sequence_Framenum); - if (!Second_Field) + if ( !Second_Field ) { Bitstream_Framenum++; Sequence_Framenum++; @@ -343,11 +345,11 @@ bool ReadMPEGFile (std::ifstream *fp, void *image_buffer, size_t length) #endif - if(base.Infile != 0) + if ( base.Infile != 0 ) { Initialize_Buffer(); - if(Show_Bits(8)==0x47) + if ( Show_Bits(8)==0x47 ) { sprintf(Error_Text,"Decoder currently does not parse transport streams\n"); Error(Error_Text); @@ -376,7 +378,7 @@ bool ReadMPEGFile (std::ifstream *fp, void *image_buffer, size_t length) Initialize_Buffer(); } - if(base.Infile!=0) + if ( base.Infile!=0 ) { //lseek(base.Infile, 0l, SEEK_SET); //fp->seekg(mpeg_start, ios_base::beg); @@ -384,12 +386,12 @@ bool ReadMPEGFile (std::ifstream *fp, void *image_buffer, size_t length) Initialize_Buffer(); - if(Two_Streams) + if ( Two_Streams ) { abort(); ld = &enhan; /* select enhancement layer context */ - if ((enhan.Infile = open(Enhancement_Layer_Bitstream_Filename,O_RDONLY|O_BINARY))<0) + if ( (enhan.Infile = open(Enhancement_Layer_Bitstream_Filename,O_RDONLY|O_BINARY))<0) { sprintf(Error_Text,"enhancment layer bitstream file %s not found\n", Enhancement_Layer_Bitstream_Filename); @@ -407,7 +409,7 @@ bool ReadMPEGFile (std::ifstream *fp, void *image_buffer, size_t length) //close(base.Infile); - if (Two_Streams) + if ( Two_Streams ) { abort(); close(enhan.Infile); diff --git a/src/gdcmPixelWriteConvert.cxx b/src/gdcmPixelWriteConvert.cxx index fc15bfb5..e5f8ae9d 100644 --- a/src/gdcmPixelWriteConvert.cxx +++ b/src/gdcmPixelWriteConvert.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelWriteConvert.cxx,v $ Language: C++ - Date: $Date: 2005/02/16 11:20:51 $ - Version: $Revision: 1.8 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.9 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -75,7 +75,7 @@ void PixelWriteConvert::SetUserData(uint8_t *data, size_t size) */ uint8_t *PixelWriteConvert::GetData() { - if(UserData) + if ( UserData ) { return UserData; } @@ -91,7 +91,7 @@ uint8_t *PixelWriteConvert::GetData() */ size_t PixelWriteConvert::GetDataSize() { - if(UserData) + if ( UserData ) { return UserDataSize; } diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index 2ec7540d..e459e53e 100644 --- a/src/gdcmSQItem.cxx +++ b/src/gdcmSQItem.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.cxx,v $ Language: C++ - Date: $Date: 2005/02/07 08:48:18 $ - Version: $Revision: 1.70 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.71 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -147,7 +147,7 @@ bool SQItem::RemoveEntry( DocEntry *entryToRemove ) it != DocEntries.end(); ++it) { - if( *it == entryToRemove ) + if ( *it == entryToRemove ) { DocEntries.erase(it); gdcmWarningMacro( "One element erased: " << entryToRemove->GetKey() ); @@ -170,7 +170,7 @@ bool SQItem::RemoveEntryNoDestroy(DocEntry *entryToRemove) it != DocEntries.end(); ++it) { - if( *it == entryToRemove ) + if ( *it == entryToRemove ) { DocEntries.erase(it); gdcmWarningMacro( "One element erased, no destroyed: " @@ -204,7 +204,7 @@ void SQItem::ClearEntry() DocEntry *SQItem::GetFirstEntry() { ItDocEntries = DocEntries.begin(); - if( ItDocEntries != DocEntries.end() ) + if ( ItDocEntries != DocEntries.end() ) return *ItDocEntries; return 0; } @@ -216,7 +216,7 @@ DocEntry *SQItem::GetFirstEntry() DocEntry *SQItem::GetNextEntry() { ++ItDocEntries; - if( ItDocEntries != DocEntries.end() ) + if ( ItDocEntries != DocEntries.end() ) return *ItDocEntries; return NULL; } diff --git a/src/gdcmSerieHelper.cxx b/src/gdcmSerieHelper.cxx index 893cc48e..9ac33693 100644 --- a/src/gdcmSerieHelper.cxx +++ b/src/gdcmSerieHelper.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSerieHelper.cxx,v $ Language: C++ - Date: $Date: 2005/06/03 16:08:16 $ - Version: $Revision: 1.9 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -88,7 +88,7 @@ void SerieHelper::AddFileName(std::string const &filename) { // Create a DICOM file File *header = new File( filename ); - if( header->IsReadable() ) + if ( header->IsReadable() ) { int allrules = 1; // First step the user has defined s set of rules for the DICOM he is looking for @@ -99,14 +99,14 @@ void SerieHelper::AddFileName(std::string const &filename) { const Rule &r = *it; const std::string s;// = header->GetEntryValue( r.first ); - if( !Util::DicomStringEqual(s, r.second.c_str())) + if ( !Util::DicomStringEqual(s, r.second.c_str()) ) { // Argh ! This rule is unmatch let's just quit allrules = 0; break; } } - if( allrules ) // all rules are respected: + if ( allrules ) // all rules are respected: { // Alright ! we have a found a DICOM that match the user expectation. // Let's add it ! @@ -177,11 +177,11 @@ void SerieHelper::SetDirectory(std::string const &dir, bool recursive) */ void SerieHelper::OrderFileList(FileList *coherentFileList) { - if( ImagePositionPatientOrdering( coherentFileList ) ) + if ( ImagePositionPatientOrdering( coherentFileList ) ) { return ; } - else if( ImageNumberOrdering(coherentFileList ) ) + else if ( ImageNumberOrdering(coherentFileList ) ) { return ; } @@ -198,7 +198,7 @@ void SerieHelper::OrderFileList(FileList *coherentFileList) FileList *SerieHelper::GetFirstCoherentFileList() { ItListHt = CoherentFileListHT.begin(); - if( ItListHt != CoherentFileListHT.end() ) + if ( ItListHt != CoherentFileListHT.end() ) return ItListHt->second; return NULL; } @@ -263,7 +263,7 @@ bool SerieHelper::ImagePositionPatientOrdering( FileList *fileList ) it = fileList->begin(); it != fileList->end(); ++it ) { - if( first ) + if ( first ) { (*it)->GetImageOrientationPatient( cosines ); @@ -319,7 +319,7 @@ bool SerieHelper::ImagePositionPatientOrdering( FileList *fileList ) // gdcmAssertMacro( CoherentFileVector.capacity() >= n ); // Find out if min/max are coherent - if( min == max ) + if ( min == max ) { gdcmWarningMacro( "Looks like all images have the exact same image position..."); return false; @@ -394,7 +394,7 @@ bool SerieHelper::ImageNumberOrdering(FileList *fileList) } // Find out if image numbers are coherent (consecutive) - if( min == max || max == 0 || max >= (n+min)) + if ( min == max || max == 0 || max >= (n+min) ) return false; std::sort(fileList->begin(), fileList->end(), SerieHelper::ImageNumberLessThan ); diff --git a/src/gdcmTS.cxx b/src/gdcmTS.cxx index 256758b9..83a82905 100644 --- a/src/gdcmTS.cxx +++ b/src/gdcmTS.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmTS.cxx,v $ Language: C++ - Date: $Date: 2005/06/09 21:14:43 $ - Version: $Revision: 1.47 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.48 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -88,7 +88,7 @@ TS::TS() { std::string filename = DictSet::BuildDictPath() + DICT_TS; std::ifstream from(filename.c_str()); - if( !from ) + if ( !from ) { gdcmWarningMacro("Can't open dictionary" << filename.c_str()); FillDefaultTSDict( TsMap ); @@ -104,7 +104,7 @@ TS::TS() from >> std::ws; std::getline(from, name); - if(key != "") + if (key != "") { TsMap[key] = name; } @@ -167,7 +167,7 @@ bool TS::IsRLELossless(TSKey const &key) { bool r = false; // First check this is an actual transfer syntax - if( IsTransferSyntax(key) ) + if ( IsTransferSyntax(key) ) { if ( key == SpecialStrings[RLELossless] ) { @@ -187,7 +187,7 @@ bool TS::IsJPEGLossless(TSKey const &key) { bool r = false; // First check this is an actual transfer syntax - if( IsTransferSyntax(key) ) + if ( IsTransferSyntax(key) ) { if ( key == SpecialStrings[JPEGFullProgressionProcess10_12] || key == SpecialStrings[JPEGLosslessProcess14] @@ -209,7 +209,7 @@ bool TS::IsJPEGLossy(TSKey const &key) { bool r = false; // First check this is an actual transfer syntax - if( IsTransferSyntax(key) ) + if ( IsTransferSyntax(key) ) { if ( key == SpecialStrings[JPEGBaselineProcess1] || key == SpecialStrings[JPEGExtendedProcess2_4] @@ -232,7 +232,7 @@ bool TS::IsJPEG2000(TSKey const &key) { bool r = false; // First check this is an actual transfer syntax - if( IsTransferSyntax(key) ) + if ( IsTransferSyntax(key) ) { if ( key == SpecialStrings[JPEG2000Lossless] || key == SpecialStrings[JPEG2000] ) @@ -252,7 +252,7 @@ bool TS::IsJPEG(TSKey const &key) { bool r = false; // First check this is an actual transfer syntax - if( IsTransferSyntax(key) ) + if ( IsTransferSyntax(key) ) { if ( IsJPEGLossy( key ) || IsJPEGLossless( key ) @@ -275,7 +275,7 @@ bool TS::IsJPEGLS(TSKey const &key) { bool r = false; // First check this is an actual transfer syntax - if( IsTransferSyntax(key) ) + if ( IsTransferSyntax(key) ) { if ( key == SpecialStrings[JPEGLSLossless] || key == SpecialStrings[JPEGLSNearLossless] ) @@ -295,7 +295,7 @@ bool TS::IsMPEG(TSKey const &key) { bool r = false; // First check this is an actual transfer syntax - if( IsTransferSyntax(key) ) + if ( IsTransferSyntax(key) ) { if ( key == SpecialStrings[MPEG2MainProfile] ) { diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index 4657435a..d36add49 100644 --- a/src/gdcmUtil.cxx +++ b/src/gdcmUtil.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmUtil.cxx,v $ Language: C++ - Date: $Date: 2005/06/08 12:24:53 $ - Version: $Revision: 1.154 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.155 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -187,17 +187,17 @@ std::string Util::CreateCleanString(std::string const &s) for(unsigned int i=0; i 0) + if (str.size() > 0 ) { - if(!isprint((unsigned char)s[str.size()-1])) + if (!isprint((unsigned char)s[str.size()-1]) ) { - if(s[str.size()-1] == 0) + if (s[str.size()-1] == 0 ) { str[str.size()-1] = ' '; } @@ -219,7 +219,7 @@ std::string Util::NormalizePath(std::string const &pathname) std::string name = pathname; int size = name.size(); - if( name[size-1] != SEPARATOR_X && name[size-1] != SEPARATOR_WIN ) + if ( name[size-1] != SEPARATOR_X && name[size-1] != SEPARATOR_WIN ) { name += SEPARATOR; } @@ -235,7 +235,7 @@ std::string Util::GetPath(std::string const &fullName) std::string res = fullName; int pos1 = res.rfind("/"); int pos2 = res.rfind("\\"); - if( pos1 > pos2) + if ( pos1 > pos2 ) { res.resize(pos1); } @@ -258,7 +258,7 @@ std::string Util::GetName(std::string const &fullName) std::string::size_type slash_pos = filename.rfind("/"); std::string::size_type backslash_pos = filename.rfind("\\"); slash_pos = slash_pos > backslash_pos ? slash_pos : backslash_pos; - if(slash_pos != std::string::npos) + if (slash_pos != std::string::npos ) { return filename.substr(slash_pos + 1); } @@ -401,7 +401,7 @@ std::string Util::DicomString(const char *s, size_t l) std::string Util::DicomString(const char *s) { size_t l = strlen(s); - if( l%2 ) + if ( l%2 ) { l++; } @@ -421,7 +421,7 @@ bool Util::DicomStringEqual(const std::string &s1, const char *s2) // s2 is the string from the DICOM reference: 'MONOCHROME1' std::string s1_even = s1; //Never change input parameter std::string s2_even = DicomString( s2 ); - if( s1_even[s1_even.size()-1] == ' ') + if ( s1_even[s1_even.size()-1] == ' ' ) { s1_even[s1_even.size()-1] = '\0'; //replace space character by null } @@ -592,7 +592,7 @@ int GetMacAddrSys ( unsigned char *addr ) char **paddrs; int sock, status=0; - if(gethostname(hostname, MAXHOSTNAMELEN) != 0) + if (gethostname(hostname, MAXHOSTNAMELEN) != 0 ) { perror("gethostname"); return -1; @@ -601,7 +601,7 @@ int GetMacAddrSys ( unsigned char *addr ) paddrs = phost->h_addr_list; sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if(sock == -1) + if (sock == -1 ) { perror("sock"); return -1; @@ -614,7 +614,7 @@ int GetMacAddrSys ( unsigned char *addr ) memcpy(&psa->sin_addr, *paddrs, sizeof(struct in_addr)); status = ioctl(sock, SIOCGARP, &parpreq); - if(status == -1) + if (status == -1 ) { perror("SIOCGARP"); return -1; @@ -651,7 +651,7 @@ int GetMacAddrSys ( unsigned char *addr ) #define ifreq_size(i) sizeof(struct ifreq) #endif // HAVE_SA_LEN - if( (sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0 ) + if ( (sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0 ) { return -1; } @@ -779,7 +779,7 @@ std::string Util::CreateUniqueUID(const std::string &root) { std::string prefix; std::string append; - if( root.empty() ) + if ( root.empty() ) { // gdcm UID prefix, as supplied by http://www.medicalconnections.co.uk prefix = RootUID; @@ -804,7 +804,7 @@ std::string Util::CreateUniqueUID(const std::string &root) append += tmp; // If append is too long we need to rehash it - if( (prefix + append).size() > 64 ) + if ( (prefix + append).size() > 64 ) { gdcmErrorMacro( "Size of UID is too long." ); // we need a hash function to truncate this number @@ -817,7 +817,7 @@ std::string Util::CreateUniqueUID(const std::string &root) void Util::SetRootUID(const std::string &root) { - if( root.empty() ) + if ( root.empty() ) RootUID = GDCM_UID; else RootUID = root; @@ -988,7 +988,7 @@ std::string Util::GetIPAddress() char szHostName[HOST_NAME_MAX+1]; int r = gethostname(szHostName, HOST_NAME_MAX); - if( r == 0 ) + if ( r == 0 ) { // Get host adresses struct hostent *pHost = gethostbyname(szHostName); @@ -997,7 +997,7 @@ std::string Util::GetIPAddress() { for( int j = 0; jh_length; j++ ) { - if( j > 0 ) str += "."; + if ( j > 0 ) str += "."; str += Util::Format("%u", (unsigned int)((unsigned char*)pHost->h_addr_list[i])[j]); diff --git a/src/gdcmVR.cxx b/src/gdcmVR.cxx index ea98ceb8..3e461697 100644 --- a/src/gdcmVR.cxx +++ b/src/gdcmVR.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmVR.cxx,v $ Language: C++ - Date: $Date: 2005/02/11 15:22:19 $ - Version: $Revision: 1.36 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.37 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -40,7 +40,7 @@ VR::VR() { std::string filename = DictSet::BuildDictPath() + DICT_VR; std::ifstream from(filename.c_str()); - if(!from) + if ( !from ) { gdcmWarningMacro("Can't open dictionary" << filename.c_str()); FillDefaultVRDict(vr); @@ -63,7 +63,7 @@ VR::VR() from >> std::ws; from.getline(buff, 1024, '\n'); - if(key != "") + if ( key != "" ) { vr[key] = name; } diff --git a/src/gdcmValEntry.cxx b/src/gdcmValEntry.cxx index 9359185d..8f92ab33 100644 --- a/src/gdcmValEntry.cxx +++ b/src/gdcmValEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmValEntry.cxx,v $ Language: C++ - Date: $Date: 2005/06/07 10:07:20 $ - Version: $Revision: 1.61 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.62 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -146,13 +146,13 @@ void ValEntry::SetValue(std::string const &val) if ( l != 0) // To avoid to be cheated by 'zero length' integers { const VRKey &vr = GetVR(); - if( vr == "US" || vr == "SS" ) + if ( vr == "US" || vr == "SS" ) { // for multivaluated items l = (Util::CountSubstring(val, "\\") + 1) * 2; ContentEntry::SetValue(val); } - else if( vr == "UL" || vr == "SL" ) + else if ( vr == "UL" || vr == "SL" ) { // for multivaluated items l = (Util::CountSubstring(val, "\\") + 1) * 4;; @@ -214,7 +214,7 @@ void ValEntry::Print(std::ostream &os, std::string const &) TSAtr v = GetValue(); d2 = Util::CreateCleanString(v); // replace non printable characters by '.' - if( (long)GetLength() <= ValEntry::GetMaxSizePrintEntry() + if ( (long)GetLength() <= ValEntry::GetMaxSizePrintEntry() || PrintLevel >= 3 || d2.find(GDCM_NOTLOADED) < d2.length() ) { diff --git a/src/gdcmValidator.cxx b/src/gdcmValidator.cxx index af42a3b6..c62079f1 100644 --- a/src/gdcmValidator.cxx +++ b/src/gdcmValidator.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmValidator.cxx,v $ Language: C++ - Date: $Date: 2005/06/17 12:15:54 $ - Version: $Revision: 1.3 $ + Date: $Date: 2005/06/24 10:55:59 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -40,7 +40,7 @@ bool CheckVM(ValEntry *v) { const std::string &s = v->GetValue(); std::string::size_type n = s.find("\\"); - if (n == s.npos) // none found + if ( n == s.npos ) // none found { n = 0; } @@ -69,7 +69,7 @@ void Validator::SetInput(ElementSet *input) } else if ( gdcm::ValEntry *v = dynamic_cast(d) ) { - if( !CheckVM(v)) + if ( !CheckVM(v) ) { std::cout << "Rah this DICOM contains one wrong tag:" << v->GetValue() << " " << -- 2.45.2