![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Dicom/GUI/DicomBrowserModel.h>
Hierarchical model of DICOM patients. More...
Inheritance diagram for DicomBrowserModel:Hierarchical model of DICOM patients.
The model has the following hierarchy:
Series can be selected with their Qt::CheckStateRole. Patients and Studies reflect the checked states of their children, e.g. can be partially checked. The actual scanning and loading of DICOM data is performed internally by a Dicom::Scanner.
Minimal Example:
Public Types | |
| enum | Roles { ParameterRole = Qt::UserRole + 1 , SortRole , PatientRole = Qt::UserRole + 3 , StudyRole = Qt::UserRole + 4 , SeriesRole = Qt::UserRole + 5 , ImageRole = Qt::UserRole + 6 , PacsSeriesProxyRole } |
| using | Image = Dicom::Image |
| using | Series = Dicom::Series |
| using | PacsSeriesProxy = Dicom::PacsSeriesProxy |
| using | Study = Dicom::Study |
| using | Patient = Dicom::Patient |
| typedef QList< QPair< QString, QString > > | ParameterList |
| List of parameters as a pair of name and value. | |
Public Slots | |
| void | addPatient (Patient *patient) |
| Adds a new patient to the model. | |
| void | remove (PacsSeriesProxy *psp) |
| Removes and deletes the given PacsSeriesProxy from the model. | |
| void | scanDirectoryAsync (const QString &directory, bool recursive, bool useDicomdirOnly, bool checkDicomHeader) |
| Scans a directory for dicom files. | |
| void | scanDirectoryBlocking (const QString &directory, bool recursive, bool useDicomdirOnly, bool checkDicomHeader) |
| Same as scanDirectoryAsync but blocks until scanning finishes. | |
| void | scanDicomDirAsync (const QString &dicomDirFile) |
| Same as scanDirectory for a DICOMDIR file. | |
| void | scanDicomDirBlocking (const QString &dicomDirFile) |
| Same as scanDicomDirAsync but blocks until scanning finishes. | |
| void | scanWebAsync (const Filesystem::Url &url) |
| Scans a DICOMweb compatible server (see Scanner::scanWeb for details). | |
| void | scanWebBlocking (const Filesystem::Url &url) |
| Same as scanWebAsync, but blocks until scanning finishes. | |
| void | scanPacsAsync (DicomPacsConfiguration pacs, const QString &patientNameFilter, const QString &studyFilter) |
| Scans the PACS server with the given configuration for existing patients and studies. | |
| void | scanPacsBlocking (DicomPacsConfiguration pacs, const QString &patientNameFilter, const QString &studyFilter) |
| Same as scanPacsAsync, but blocks until scanning finishes. | |
| void | getPacsSeriesAsync (PacsSeriesProxy *pcp) |
| Retrieves all series of the Study the PacsSeriesProxy is assigned to. | |
| void | getPacsSeriesBlocking (PacsSeriesProxy *pcp) |
| Same as getPacsSeriesAsync but blocks until all series are received. | |
| bool | cancelScan (std::chrono::milliseconds timeout=std::chrono::seconds(2)) |
| Cancels any active scanning and returns whether the scanning could be cancelled in the given timeout. | |
| bool | isScanning () const |
| Returns whether DICOMs are still scanned in the background. | |
| void | clear () |
| Removes all patients from the model. | |
Signals | |
| void | scanProgressRangeChanged (int min, int max) |
| void | scanProgressValueChanged (int value) |
| void | scanProgressTextChanged (QString text) |
| void | isScanningChanged (bool isScanning) |
| void | scanHttpError (QString message, Network::HttpStatus status) |
Public Member Functions | |
| DicomBrowserModel (Dicom::SharedDatasetCache cache=nullptr, QObject *parent=nullptr) | |
| Constructs an empty DicomBrowserModel. | |
| DicomBrowserModel (const std::vector< std::shared_ptr< DcmDataset > > &datasets, const std::vector< std::string > &datasetPaths, Dicom::SharedDatasetCache cache=nullptr, QObject *parent=nullptr) | |
| Constructs a new DicomBrowserModel and initializes it with patients from the given datasets. | |
| void | setDatasetCache (Dicom::SharedDatasetCache cache) |
| Replaces the current DatasetCache with the given one. | |
| Dicom::SharedDatasetCache | datasetCache () const |
| void | setUpdateSeriesDimensionsAfterScan (bool enable) |
| Sets whether the kind field of each Series is updated automatically after scanning. | |
| bool | isUpdatingSeriesDimensionsAfterScan () const |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| Always return 1. | |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| Qt::ItemFlags | flags (const QModelIndex &index) const override |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
| Only accepted role is Qt::CheckStateRole, except for images which cannot be edited at all. | |
| QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
| QModelIndex | parent (const QModelIndex &index) const override |
| QModelIndex | index (Patient *patient) const |
| QModelIndex | index (Study *study) const |
| QModelIndex | index (Series *series) const |
| QModelIndex | index (PacsSeriesProxy *series) const |
| QList< Series * > | selectedSeries () const |
| Returns all currently checked Series. | |
| const std::vector< Patient * > & | patients () const |
| Returns all patients currently belonging to this DicomBrowserModel. | |
| bool | scanCompleted () const |
| Returns whether the last scan has been completed. | |
Static Public Member Functions | |
| static std::string | retrieveLocationString (const std::vector< Series * > &series, bool ignoreNonDicomFiles=true) |
| Creates a location string from the given series. | |
Protected Member Functions | |
| void | scanAsync (DicomPacsConfiguration *pacs, std::function< void(Dicom::ScannerQt &)> scanMethod) |
| void | scanBlocking (DicomPacsConfiguration *pacs, std::function< void(Dicom::ScannerQt &)> scanMethod) |
| void | updateSeriesDimensionsAsync () |
| Starts a background task that calls Series::updateDimensions on each Series. | |
| Patient * | toPatient (const QModelIndex &index) const |
| Series * | toSeries (const QModelIndex &index) const |
| Study * | toStudy (const QModelIndex &index) const |
| Image * | toImage (const QModelIndex &index) const |
| PacsSeriesProxy * | toPacsSeriesPlaceholder (const QModelIndex &index) const |
| Qt::CheckState | isChecked (Patient *patient) const |
| Qt::CheckState | isChecked (Study *study) const |
| enum Roles |
| Enumerator | |
|---|---|
| ParameterRole | Role to retrieve all parameters of an index as a ParameterList. |
| SortRole | Special role used to compare indices (e.g. patients by name). Values should be unique to assure stable sorting. |
| PatientRole | Retrieves the Patient* object from an index or QVariant() if index is not a patient. |
| StudyRole | Retrieves the Study* object from an index or QVariant() if index is not a study. |
| SeriesRole | Retrieves the Series* object from an index or QVariant() if index is not a series. |
| ImageRole | Retrieves the Image* object from an index or QVariant() if index is not an image. |
| PacsSeriesProxyRole | Retrieves the PacsSeriesPlaceholder* object from an index or QVariant() if index is not an image. |
| DicomBrowserModel | ( | Dicom::SharedDatasetCache | cache = nullptr, |
| QObject * | parent = nullptr ) |
Constructs an empty DicomBrowserModel.
If a cache cache is supplied, any dataset that is loaded during scanning will be added to the cache. The cache is NOT used to retrieve any datasets (to avoid threading issues).
| DicomBrowserModel | ( | const std::vector< std::shared_ptr< DcmDataset > > & | datasets, |
| const std::vector< std::string > & | datasetPaths, | ||
| Dicom::SharedDatasetCache | cache = nullptr, | ||
| QObject * | parent = nullptr ) |
Constructs a new DicomBrowserModel and initializes it with patients from the given datasets.
datasetPaths must contain the origin path to each dataset in datasets. datasets and datasetPaths must be of the same length.
| void setDatasetCache | ( | Dicom::SharedDatasetCache | cache | ) |
Replaces the current DatasetCache with the given one.
nullptr disables caching. Changing the cache while isScanning is true is not supported!
| void setUpdateSeriesDimensionsAfterScan | ( | bool | enable | ) |
Sets whether the kind field of each Series is updated automatically after scanning.
Since this needs to iterate over all files of each series, this can take about as long as scanning itself. In the case of the scan...Async methods, the scanProgress will be used to report the progress of the update (starting from 0 again after the scan has finished but with a different text). Disabled by default.
|
override |
Only accepted role is Qt::CheckStateRole, except for images which cannot be edited at all.
If a Patient/Study is (un)checked, it will (un)check all its children Studies/Series.
| bool scanCompleted | ( | ) | const |
Returns whether the last scan has been completed.
If it has not, the information in patients() may not be complete!
|
static |
Creates a location string from the given series.
This string can be used as location parameter in the DicomIOAlgorithm to load the given series.
|
slot |
Adds a new patient to the model.
Will be merged with existing patients of the same id.
|
slot |
Scans a directory for dicom files.
This method is executed async and returns immediately. When the scanner finds a series, it is not instantly added to the model but only the next time the Qt mainthread processes events. This means that the control flow must pass to the Qt main event loop at some point, otherwise patients() might still be empty even when isScanning() returns false. If you cannot return to the Qt main event loop use scanDirectoryBlocking instead. Check the class documentation for a common usage example.
|
slot |
Scans a DICOMweb compatible server (see Scanner::scanWeb for details).
The scanDirectoryAsync on how the asynchronous part works.
|
slot |
Scans the PACS server with the given configuration for existing patients and studies.
Will only download Patient and Study data. Series and Image data will not be received in order to preserve bandwidth and time. Use getPacsSeries() to receive all Series for a given Study.