CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkDICOMIndexer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkDICOMIndexer_h
22 #define __ctkDICOMIndexer_h
23 
24 // Qt includes
25 #include <QObject>
26 #include <QSqlDatabase>
27 
28 #include "ctkDICOMCoreExport.h"
29 #include "ctkDICOMDatabase.h"
30 
31 class ctkDICOMIndexerPrivate;
32 
37 class CTK_DICOM_CORE_EXPORT ctkDICOMIndexer : public QObject
38 {
39  Q_OBJECT
40 public:
41  explicit ctkDICOMIndexer(QObject *parent = 0);
42  virtual ~ctkDICOMIndexer();
43 
55  Q_INVOKABLE void addDirectory(ctkDICOMDatabase& database, const QString& directoryName,
56  const QString& destinationDirectoryName = "", bool includeHidden = true);
57 
65  Q_INVOKABLE bool addDicomdir(ctkDICOMDatabase& database, const QString& directoryName,
66  const QString& destinationDirectoryName = "");
67 
75  Q_INVOKABLE void addListOfFiles(ctkDICOMDatabase& database, const QStringList& listOfFiles,
76  const QString& destinationDirectoryName = "");
77 
85  Q_INVOKABLE void addFile(ctkDICOMDatabase& database, const QString filePath,
86  const QString& destinationDirectoryName = "");
87 
88  Q_INVOKABLE void refreshDatabase(ctkDICOMDatabase& database, const QString& directoryName);
89 
96  Q_INVOKABLE void waitForImportFinished();
97 
107  Q_INVOKABLE void startIndexing(ctkDICOMDatabase& database);
108 
111  Q_INVOKABLE void endIndexing();
112 
126  {
127  public:
129  {
130  this->Indexer = &indexer;
131  this->Indexer->startIndexing(database);
132  }
134  {
135  this->Indexer->endIndexing();
136  }
137  private:
138  ctkDICOMIndexer* Indexer;
139  };
140 
141 Q_SIGNALS:
142  void foundFilesToIndex(int);
144  void indexingFilePath(QString);
145  void progress(int);
147 
148 public Q_SLOTS:
149  void cancel();
150 
151 protected:
152  QScopedPointer<ctkDICOMIndexerPrivate> d_ptr;
153 
154 private:
155  Q_DECLARE_PRIVATE(ctkDICOMIndexer);
156  Q_DISABLE_COPY(ctkDICOMIndexer);
157 
158 };
159 
160 #endif
ScopedIndexing(ctkDICOMIndexer &indexer, ctkDICOMDatabase &database)
Indexes DICOM images located in local directory into an Sql database.
void foundFilesToIndex(int)
Q_INVOKABLE void endIndexing()
void indexingFileNumber(int)
Q_INVOKABLE void addDirectory(ctkDICOMDatabase &database, const QString &directoryName, const QString &destinationDirectoryName="", bool includeHidden=true)
Adds directory to database and optionally copies files to destinationDirectory.
virtual ~ctkDICOMIndexer()
Q_INVOKABLE void startIndexing(ctkDICOMDatabase &database)
Q_INVOKABLE bool addDicomdir(ctkDICOMDatabase &database, const QString &directoryName, const QString &destinationDirectoryName="")
Adds directory to database by using DICOMDIR and optionally copies files to destinationDirectory....
Q_INVOKABLE void refreshDatabase(ctkDICOMDatabase &database, const QString &directoryName)
Q_INVOKABLE void addFile(ctkDICOMDatabase &database, const QString filePath, const QString &destinationDirectoryName="")
Adds a file to database and optionally copies the file to destinationDirectory.
void indexingFilePath(QString)
void progress(int)
QScopedPointer< ctkDICOMIndexerPrivate > d_ptr
Q_INVOKABLE void waitForImportFinished()
Deprecated - no op.
ctkDICOMIndexer(QObject *parent=0)
void indexingComplete()
Q_INVOKABLE void addListOfFiles(ctkDICOMDatabase &database, const QStringList &listOfFiles, const QString &destinationDirectoryName="")
Adds a QStringList containing the file path to database and optionally copies files to destinationDir...