X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkDicomInfo.cxx;h=183f09febbe63ca7eea4819590c11b57e531ad3f;hb=5578995d9a82792833333eeb3dd5c8ecac967293;hp=d4506a2e6cbf52b73ef6d4c80438c951ec1778d6;hpb=573d80d0f7a17607d2ee883c21c940c0ba020282;p=clitk.git diff --git a/tools/clitkDicomInfo.cxx b/tools/clitkDicomInfo.cxx index d4506a2..183f09f 100644 --- a/tools/clitkDicomInfo.cxx +++ b/tools/clitkDicomInfo.cxx @@ -28,6 +28,12 @@ // itk (gdcm) include #include "gdcmFile.h" +#if GDCM_MAJOR_VERSION >= 2 +#include "gdcmReader.h" +#include "gdcmPrinter.h" +#include "gdcmDict.h" +#include "gdcmStringFilter.h" +#endif //-------------------------------------------------------------------- int main(int argc, char * argv[]) @@ -39,13 +45,61 @@ int main(int argc, char * argv[]) // check arg if (args_info.inputs_num == 0) return 0; + // Study ID + #if GDCM_MAJOR_VERSION >= 2 + if (args_info.studyID_flag) { + std::set l; + for(unsigned int i=0; i tags; + gdcm::Tag StudyInstanceUIDTag(0x0020, 0x000d); + gdcm::Tag SeriesDateTag(0x0008, 0x0021); + tags.insert(StudyInstanceUIDTag); + tags.insert(SeriesDateTag); + if (reader.ReadSelectedTags(tags)) { + gdcm::StringFilter sf; + sf.SetFile(reader.GetFile()); + std::pair p = sf.ToStringPair(StudyInstanceUIDTag); + std::pair d = sf.ToStringPair(SeriesDateTag); + if (args_info.uniq_flag) { + if (l.insert(p.second).second == true) { + if (args_info.filename_flag) + std::cout << args_info.inputs[i] << " " << p.second << " " << d.second << std::endl; + else + std::cout << p.second << std::endl; + } + } + else { + if (args_info.filename_flag) + std::cout << args_info.inputs[i] << " " << p.second << " " << d.second << std::endl; + else + std::cout << p.second << std::endl; + } + } // tag not found + } + } +#endif + // Loop files + if (!args_info.studyID_flag) for(unsigned int i=0; i= 2 + gdcm::Reader reader; + reader.SetFileName(args_info.inputs[i]); + reader.Read(); + gdcm::Printer printer; + printer.SetFile(reader.GetFile()); + printer.SetStyle(gdcm::Printer::VERBOSE_STYLE); + printer.Print( std::cout ); +#else gdcm::File *header = new gdcm::File(); header->SetFileName(args_info.inputs[i]); header->SetMaxSizeLoadEntry(163840); header->Load(); header->Print(); +#endif } // this is the end my friend