]> Creatis software - creaImageIO.git/blobdiff - src/creaImageIODicomDatabase.h
clean old version of creaImageIO
[creaImageIO.git] / src / creaImageIODicomDatabase.h
diff --git a/src/creaImageIODicomDatabase.h b/src/creaImageIODicomDatabase.h
deleted file mode 100644 (file)
index da40be2..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-#ifndef __creaImageIODicomDatabase_h_INCLUDED__
-#define __creaImageIODicomDatabase_h_INCLUDED__
-
-
-#include <creaImageIODicomNode.h>
-#include <creaImageIOImageReader.h>
-
-#include <vector>
-#include <wx/wx.h>
-#include <wx/progdlg.h>
-
-class CppSQLite3DB;
-
-namespace creaImageIO
-{
-
-
-  //=====================================================================
-  class DicomDatabase : public DicomNode
-  {
-  public:
-
-    /// Creates a database associated to the file 'filename'.
-    /// Does not create the db nor reads any data from the file
-    DicomDatabase(const std::string& filename, int flags = 0);
-    /// Dtor
-    ~DicomDatabase();
-    
-      /// Returns the DicomNodeTypeDescription for DicomNodes of type c
-    DicomNodeTypeDescription& GetDicomNodeTypeDescription(DicomNode::Type c) 
-    { return mDicomNodeTypeDescription[c]; }
-    /// Returns the DicomNodeTypeDescription for DicomNodes of type c (const)
-    const DicomNodeTypeDescription& GetDicomNodeTypeDescription(DicomNode::Type c) const
-    { return mDicomNodeTypeDescription[c]; }
-
-
-    /// Returns the sqlite db file name 
-    const std::string& GetFileName() const { return UnsafeGetFieldValue("File name"); }
-    void SetName(const std::string& n) { UnsafeSetFieldValue("Name",n); }
-    const std::string& GetName() const { return UnsafeGetFieldValue("Name"); }
-
-
-    void Print() const;
-
-
-    //=============================================================
-    void Clear();
-    bool LocationIsValid();
-    /// Creates a new db on disk 
-    bool New();
-    /// Opens an existing db on disk
-    bool Open();
-    /// Closes the db
-    bool Close();
-
-    /// Recursively loads the children of node 'parent' until maxlevel 
-    /// is reached.
-    /// If parent == NULL or parent == this then starts with the 'children' of 
-    /// the database itself, i.e. the patients.
-    /// Returns the total number of children loaded.
-    int DBLoadChildren(DicomNode* parent, DicomNode::Type maxlevel);
-   
-    /// 
-
-    struct UpdateSummary
-    {
-      int scanned_dirs;
-      int scanned_files;
-      int handled_images;
-      int added_images;
-
-      int added_patients;
-      int added_studies;
-      int added_series;
-
-      long parse_time;
-      long file_scan_time;
-      long update_structs_time;
-      long update_database_time;
-      long total_time;
-      bool cancelled_by_user;
-      
-      UpdateSummary() :
-       scanned_dirs(0),
-       scanned_files(0),
-       handled_images(0),
-       added_images(0),
-       added_patients(0),
-       added_studies(0),
-       added_series(0),
-       parse_time(0),
-       file_scan_time(0),
-       update_structs_time(0),
-       update_database_time(0),
-       total_time(0),
-       cancelled_by_user(false)
-      {}
-    };
-
-
-    ///
-    bool IsHandledFile( const std::string& filename);
-    bool AddFile( const std::string& filename,
-                 UpdateSummary& summary );
-    bool AddFiles( const std::vector<std::string>& filename,
-                  wxProgressDialog* progress, 
-                  UpdateSummary& summary);
-    bool AddDirectory( const std::string& directory, 
-                      bool recurse,
-                      wxProgressDialog* progress, 
-                      UpdateSummary& summary
-                      );
-
-    void ParseDirectory( const std::string& directory, 
-                        std::vector<std::string> &Filenames,
-                        bool recurse,
-                        wxProgressDialog* progress, 
-                        UpdateSummary& summary);
-
-
-    /// Removes the node and its descendants from the db
-    bool Remove(DicomNode*);
-    //=============================================================
-
-
-   int DBQueryNumberOfChildren(DicomNode* n);
-
-  protected:
-    // Open 
-    bool OpenDB();
-    void ImportDicomNodeTypeDescriptionsFromDB();
-
-    // Creation
-    bool CreateDB();
-    void BuildDefaultDicomNodeTypeDescriptions();
-    void AppendSQLFieldsDefinition(DicomNode::Type c, std::string& s);
-    void ExportDicomNodeTypeDescriptionsToDB();
-    //
-
-    // Test
-    bool DBStructureIsValid();
-
-    
-    // Insertion
-    bool DBInsert(DicomNode* alien_node, UpdateSummary& summary);
-    
-    //
-    std::string DBGetDicomNodeId(DicomNode* node, const std::string& parent_id);
-    DicomNode* GetDicomNodeFromTypeId(DicomNode::Type t, const std::string& id);
-
-    // 
-    DicomNode* DBGetOrCreateDicomNode(DicomNode* alien_node, 
-                                     DicomNode* internal_parent,
-                                     std::string parentid,
-                                     std::string& created_id, 
-                                     UpdateSummary& summary);
-    
-    DicomNode* DBGetOrCreateParent(DicomNode* alien_node,
-                                  std::string& parent_id, 
-                                  UpdateSummary& summary);
-    
-    void DBRecursiveGetOrCreateDicomNode(DicomNode* alien_node, 
-                                        DicomNode* parent, 
-                                        const std::string& parent_id, 
-                                        UpdateSummary& summary);
-    
-
-    // 
-    void DBRecursiveRemoveDicomNode(DicomNode* node);
-
-
-    void BuildSQLFieldsValues(DicomNode* n,
-                             std::string& str);
-
-
-    DicomNode* GetChildrenLike(DicomNode* internal_parent,
-                              DicomNode* alien_node);
-
-  private:
-    CppSQLite3DB* mDB;
-    ImageReader mReader;
-
-
-    struct TypeId
-    {
-      int type;
-      std::string id;
-      bool operator< (const TypeId& o) const 
-      {
-       return ((type<o.type) ||
-               ((type==o.type)&&id<o.id));
-      }
-    };
-    
-    typedef std::map<TypeId,DicomNode*> TypeIdToDicomNodeMapType;
-    TypeIdToDicomNodeMapType mTypeIdToDicomNodeMap;
-
-    
-    /// The 5 descriptions of node types (Database,Patient,Study,Series,Image)
-    /// The array is accessed through the DicomNode::TypeCode
-    DicomNodeTypeDescription mDicomNodeTypeDescription[5];
-    
-
-    /// The physical location associated to the DicomDatabase (directory, db file...)
-    std::string mFileName;
-
-    std::string mName;
-
-    int mFlags;
-
-    wxStopWatch msw[10];
-
-  }; // class DicomDatabase
-  //=====================================================================
-
-
-
-} // namespace creaImageIO
-
-
-
-#endif // #ifndef __creaImageIODicomDatabase_h_INCLUDED__