1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
19 -------------------------------------------------
20 * @file clitkDicomInfo.cxx
21 * @author Laurent ZAGNI <laurent.zagni@insa-lyon.fr>
23 -------------------------------------------------*/
26 #include "clitkDicomInfo_ggo.h"
27 #include "clitkCommon.h"
31 #if GDCM_MAJOR_VERSION == 2
32 #include "gdcmReader.h"
33 #include "gdcmPrinter.h"
35 #include "gdcmStringFilter.h"
38 //--------------------------------------------------------------------
39 int main(int argc, char * argv[])
43 GGO(clitkDicomInfo, args_info);
46 if (args_info.inputs_num == 0) return 0;
49 #if GDCM_MAJOR_VERSION == 2
50 if (args_info.studyID_flag) {
51 std::set<std::string> l;
52 for(unsigned int i=0; i<args_info.inputs_num; i++) {
54 reader.SetFileName(args_info.inputs[i]);
55 std::set<gdcm::Tag> tags;
56 gdcm::Tag StudyInstanceUIDTag(0x0020, 0x000d);
57 gdcm::Tag SeriesDateTag(0x0008, 0x0021);
58 tags.insert(StudyInstanceUIDTag);
59 tags.insert(SeriesDateTag);
60 if (reader.ReadSelectedTags(tags)) {
61 gdcm::StringFilter sf;
62 sf.SetFile(reader.GetFile());
63 std::pair<std::string, std::string> p = sf.ToStringPair(StudyInstanceUIDTag);
64 std::pair<std::string, std::string> d = sf.ToStringPair(SeriesDateTag);
65 if (args_info.uniq_flag) {
66 if (l.insert(p.second).second == true) {
67 if (args_info.filename_flag)
68 std::cout << args_info.inputs[i] << " " << p.second << " " << d.second << std::endl;
70 std::cout << p.second << std::endl;
74 if (args_info.filename_flag)
75 std::cout << args_info.inputs[i] << " " << p.second << " " << d.second << std::endl;
77 std::cout << p.second << std::endl;
85 if (!args_info.studyID_flag)
86 for(unsigned int i=0; i<args_info.inputs_num; i++) {
87 if (args_info.filename_flag) std::cout << args_info.inputs[i] << std::endl;
88 #if GDCM_MAJOR_VERSION == 2
90 reader.SetFileName(args_info.inputs[i]);
92 gdcm::Printer printer;
93 printer.SetFile(reader.GetFile());
94 printer.SetStyle(gdcm::Printer::VERBOSE_STYLE);
95 printer.Print( std::cout );
97 gdcm::File *header = new gdcm::File();
98 header->SetFileName(args_info.inputs[i]);
99 header->SetMaxSizeLoadEntry(163840);
105 // this is the end my friend
108 //--------------------------------------------------------------------