-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathImageViewerPlugin.h
More file actions
163 lines (129 loc) · 4.71 KB
/
Copy pathImageViewerPlugin.h
File metadata and controls
163 lines (129 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#pragma once
#include "ViewPlugin.h"
#include "LayersModel.h"
#include "ImageViewerWidget.h"
#include "SelectionToolbarAction.h"
#include "InteractionToolbarAction.h"
#include "SettingsAction.h"
#include <widgets/DropWidget.h>
#include <actions/TriggerAction.h>
#include <QItemSelectionModel>
#include <QSplitter>
using mv::plugin::ViewPluginFactory;
using mv::plugin::ViewPlugin;
using namespace mv::gui;
/**
* Image viewer plugin class
* This HDPS view plugin class provides functionality to view/interact with high-dimensional image data
*
* @author Thomas Kroes
*/
class ImageViewerPlugin : public ViewPlugin
{
Q_OBJECT
public:
/** Spatial layout of layers */
enum class LayersLayout {
Stacked, /** Layers are stacked on top of each other */
Vertical, /** Layers are arranged from top to bottom */
Horizontal, /** Layers are arranged from left to right */
Grid /** Layers are arranged in a grid */
};
public:
/** Constructor */
ImageViewerPlugin(mv::plugin::PluginFactory* factory);
public: // Inherited from ViewPlugin
/** Initializes the plugin */
void init() override;
/**
* Load one (or more datasets in the view)
* @param datasets Dataset(s) to load
*/
void loadData(const mv::Datasets& datasets) override;
/**
* Arrange layers in layout
* @param layersLayout Layout of the layers
*/
void arrangeLayers(LayersLayout layersLayout);
/**
* Add dataset to the viewer
* @param dataset Smart pointer to images dataset
*/
void addDataset(const mv::Dataset<Images>& dataset);
public: // Miscellaneous
/** Get the layers model */
LayersModel& getLayersModel() {
return _layersModel;
}
/** Get the layers selection model */
QItemSelectionModel& getSelectionModel() {
return _selectionModel;
}
/** Get reference to the image viewer widget */
ImageViewerWidget& getImageViewerWidget() {
return _imageViewerWidget;
}
protected:
/** Invoked when the layer selection changed */
void onLayerSelectionChanged();
/**
* Converts a non-images dataset to an images dataset and adds the created dataset as a layer
* @param dataset Smart pointer to the dataset that will be converted and added
*/
void immigrateDataset(const mv::Dataset<mv::DatasetImpl>& dataset);
public: // Serialization
/**
* Load widget action from variant map
* @param Variant map representation of the widget action
*/
void fromVariantMap(const mv::VariantMap& variantMap) override;
/**
* Save widget action to variant map
* @return Variant map representation of the widget action
*/
mv::VariantMap toVariantMap() const override;
public: // Action getters
SelectionToolbarAction& getSelectionToolbarAction() { return _selectionToolbarAction; }
InteractionToolbarAction& getInteractionToolbarAction() { return _interactionToolbarAction; }
SettingsAction& getSettingsAction() { return _settingsAction; }
private:
LayersModel _layersModel; /** Layers model */
QItemSelectionModel _selectionModel; /** Layers selection model */
ImageViewerWidget _imageViewerWidget; /** Image viewer widget */
DropWidget _dropWidget; /** Widget for dropping data */
SelectionToolbarAction _selectionToolbarAction; /** Toolbar action for selection */
InteractionToolbarAction _interactionToolbarAction; /** Toolbar action for interaction */
SettingsAction _settingsAction; /** Layers settings action */
};
/**
* Image viewer plugin factory class
* A factory for creating image viewer plugin instances
*/
class ImageViewerPluginFactory : public ViewPluginFactory
{
Q_INTERFACES(mv::plugin::ViewPluginFactory mv::plugin::PluginFactory)
Q_OBJECT
Q_PLUGIN_METADATA(IID "nl.BioVault.ImageViewerPlugin" FILE "ImageViewerPlugin.json")
public:
/** Default constructor */
ImageViewerPluginFactory() {}
/** Destructor */
~ImageViewerPluginFactory() override {}
/**
* Get plugin icon
* @param color Icon color for flat (font) icons
* @return Icon
*/
QIcon getIcon(const QColor& color = Qt::black) const override;
/**
* Produces the plugin
* @return Pointer to the produced plugin
*/
ImageViewerPlugin* produce() override;
/**
* Get plugin trigger actions given \p datasets
* @param datasets Vector of input datasets
* @return Vector of plugin trigger actions
*/
PluginTriggerActions getPluginTriggerActions(const mv::Datasets& datasets) const override;
};