]> Creatis software - creaImageIO.git/blob - src2/creaImageIOImageFinder.h
Starting version 2
[creaImageIO.git] / src2 / creaImageIOImageFinder.h
1 #ifndef __creaImageIOImageFinder_h_INCLUDED__
2 #define __creaImageIOImageFinder_h_INCLUDED__
3
4 #include <creaImageIOTreeHandler.h>
5 #include <creaImageIOImageReader.h>
6 #include <wx/wx.h>
7 #include <wx/progdlg.h>
8
9 namespace creaImageIO
10 {
11
12
13   //=======================================================================
14   /// Parses (recursively) a part of a filesystem to look for known images and load their attributes in order to add the images to a Tree (submission via a TreeHandler::AddBranch)
15   class ImageFinder
16   {
17   public:
18     ///====================================================================
19     /// Ctor
20     ImageFinder(TreeHandler* tree);
21     /// Dtor
22     ~ImageFinder();
23     ///====================================================================
24     
25     struct UpdateSummary
26     {
27       int scanned_dirs;
28       int scanned_files;
29       int handled_images;
30       int added_images;
31
32       int added_patients;
33       int added_studies;
34       int added_series;
35
36       long parse_time;
37       long file_scan_time;
38       long update_structs_time;
39       long update_database_time;
40       long total_time;
41       bool cancelled_by_user;
42       
43       UpdateSummary() :
44         scanned_dirs(0),
45         scanned_files(0),
46         handled_images(0),
47         added_images(0),
48         added_patients(0),
49         added_studies(0),
50         added_series(0),
51         parse_time(0),
52         file_scan_time(0),
53         update_structs_time(0),
54         update_database_time(0),
55         total_time(0),
56         cancelled_by_user(false)
57       {}
58     };
59       ///
60     bool IsHandledFile( const std::string& filename);
61     bool AddFile( const std::string& filename,
62                   UpdateSummary& summary );
63     bool AddFiles( const std::vector<std::string>& filename,
64                    wxProgressDialog* progress, 
65                    UpdateSummary& summary);
66     bool AddDirectory( const std::string& directory, 
67                        bool recurse,
68                        wxProgressDialog* progress, 
69                        UpdateSummary& summary
70                        );
71
72     void ParseDirectory( const std::string& directory, 
73                          std::vector<std::string> &Filenames,
74                          bool recurse,
75                          wxProgressDialog* progress, 
76                          UpdateSummary& summary);
77   private:
78     TreeHandler* mTreeHandler;
79     ImageReader mReader;
80    wxStopWatch msw[10];
81
82   };
83   // EO class ImageFinder
84   //=======================================================================
85
86
87 } // EO namespace creaImageIO
88
89 // EOF
90 #endif  
91