fw4spl
SFilterSelectionEditor.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include "ioDicom/SFilterSelectionEditor.hpp"
8 
9 #include <fwData/Vector.hpp>
10 
11 #include <fwDicomIOFilter/composite/IComposite.hpp>
12 #include <fwDicomIOFilter/exceptions/FilterFailure.hpp>
13 #include <fwDicomIOFilter/helper/Filter.hpp>
14 #include <fwDicomIOFilter/registry/detail.hpp>
15 
16 #include <fwGui/dialog/MessageDialog.hpp>
17 
18 #include <fwGuiQt/container/QtContainer.hpp>
19 
20 #include <fwMedDataTools/helper/SeriesDB.hpp>
21 
22 #include <fwRuntime/operations.hpp>
23 
24 #include <fwServices/macros.hpp>
25 
26 #include <QGridLayout>
27 #include <QHBoxLayout>
28 #include <QLabel>
29 #include <QMenu>
30 #include <QSignalMapper>
31 #include <QVBoxLayout>
32 
33 namespace ioDicom
34 {
35 
37 
38 //------------------------------------------------------------------------------
39 
41 {
42 }
43 //------------------------------------------------------------------------------
44 
46 {
47 }
48 
49 //------------------------------------------------------------------------------
50 
51 void SFilterSelectionEditor::info(std::ostream& _sstream )
52 {
53  _sstream << "SFilterSelectionEditor::info";
54 }
55 
56 //------------------------------------------------------------------------------
57 
59 {
61 }
62 
63 //------------------------------------------------------------------------------
64 
66 {
68 
69  // Get Destination SeriesDB
70  m_destinationSeriesDB = this->getInOut< ::fwMedData::SeriesDB>("target");
71  SLM_ASSERT("The SeriesDB \"" + m_destinationSeriesDBID + "\" doesn't exist.", m_destinationSeriesDB);
72 
73  ::fwData::Vector::csptr dataVector = this->getInput< ::fwData::Vector >("selection");
74  SLM_ASSERT("Vector object should not be null.", dataVector);
75 
77  ::fwGuiQt::container::QtContainer::sptr qtContainer = fwGuiQt::container::QtContainer::dynamicCast(getContainer());
78 
79  QVBoxLayout* mainLayout = new QVBoxLayout();
80  mainLayout->setAlignment(Qt::AlignTop);
81  qtContainer->setLayout(mainLayout);
82 
83  // Size policy
84  QSizePolicy policy(QSizePolicy::Maximum, QSizePolicy::Preferred);
85 
86  // Top widget
87  QHBoxLayout* topLayout = new QHBoxLayout();
88  QWidget* topWidget = new QWidget();
89  topWidget->setLayout(topLayout);
90  topLayout->setContentsMargins(QMargins(0, 0, 0, 0));
91  mainLayout->addWidget(topWidget);
92 
93  // Available filter list
94  m_availableFilterListWidget = new QComboBox();
95  this->fillAvailableFilters();
96  topLayout->addWidget(m_availableFilterListWidget);
97 
98  auto path = ::fwRuntime::getBundleResourcePath("media");
99 
100  // Add filter button
101  m_addFilterButton = new QPushButton(QIcon(QString::fromStdString((path / "icons/Plus.svg").string())), "Add");
102  m_addFilterButton->setSizePolicy(policy);
103  topLayout->addWidget(m_addFilterButton);
104 
105  // Add selected filters
106  m_selectedFilterListWidget = new QListWidget();
107  mainLayout->addWidget(m_selectedFilterListWidget);
108  m_selectedFilterListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
109  m_selectedFilterListWidget->setDragEnabled(true);
110  m_selectedFilterListWidget->viewport()->setAcceptDrops(true);
111  m_selectedFilterListWidget->setDropIndicatorShown(true);
112  m_selectedFilterListWidget->setDragDropMode(QAbstractItemView::InternalMove);
113  m_selectedFilterListWidget->setContextMenuPolicy(Qt::CustomContextMenu);
114 
115  // Add forced apply checkbox
116  QHBoxLayout* applyLayout = new QHBoxLayout();
117  QWidget* applyWidget = new QWidget();
118  applyWidget->setLayout(applyLayout);
119  applyWidget->setSizePolicy(policy);
120  applyLayout->setContentsMargins(QMargins(0, 0, 0, 0));
121  m_forcedApplyCheckBox = new QCheckBox("Ignore errors");
122  applyLayout->addWidget(m_forcedApplyCheckBox);
123  mainLayout->addWidget(applyWidget, 0, Qt::AlignRight);
124 
125  // Bottom widget
126  QHBoxLayout* bottomLayout = new QHBoxLayout();
127  QWidget* bottomWidget = new QWidget();
128  bottomWidget->setLayout(bottomLayout);
129  bottomLayout->setContentsMargins(QMargins(0, 0, 0, 0));
130  mainLayout->addWidget(bottomWidget);
131 
132  QHBoxLayout* buttonLayout = new QHBoxLayout();
133  QWidget* buttonWidget = new QWidget();
134  buttonWidget->setLayout(buttonLayout);
135  buttonWidget->setSizePolicy(policy);
136  buttonLayout->setContentsMargins(QMargins(0, 0, 0, 0));
137 
138  // Apply filters button
139  m_applyFiltersButton = new QPushButton(QIcon(QString::fromStdString((path / "icons/Apply.svg").string())), "Apply");
140  m_applyFiltersButton->setSizePolicy(policy);
141  buttonLayout->addWidget(m_applyFiltersButton);
142 
143  // Configure filter button
144  m_configureFilterButton = new QPushButton(QIcon(QString::fromStdString((path / "icons/Settings.svg").string())),
145  "Configure");
146  m_configureFilterButton->setSizePolicy(policy);
147  m_configureFilterButton->setEnabled(false);
148  buttonLayout->addWidget(m_configureFilterButton);
149 
150  // Split filter button
151  m_splitFilterButton = new QPushButton(QIcon(QString::fromStdString((path / "icons/Split.svg").string())), "Split");
152  m_splitFilterButton->setSizePolicy(policy);
153  m_splitFilterButton->setEnabled(false);
154  buttonLayout->addWidget(m_splitFilterButton);
155 
156  // Remove filter button
158  new QPushButton(QIcon(QString::fromStdString((path / "icons/Minus.svg").string())), "Remove");
159  m_removeFilterButton->setSizePolicy(policy);
160  m_removeFilterButton->setEnabled(false);
161  buttonLayout->addWidget(m_removeFilterButton);
162 
163  bottomLayout->addWidget(buttonWidget, 0, Qt::AlignRight);
164 
165  // Create shortcut
167  new QShortcut(QKeySequence(Qt::Key_Delete), m_selectedFilterListWidget, 0, 0, Qt::WidgetShortcut);
168 
169  // Connect the signals
170  QObject::connect(m_selectedFilterListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(updateButtonStatus(int)));
171  QObject::connect(m_addFilterButton, SIGNAL(clicked(void)), this, SLOT(addFilterAtTheEnd(void)));
172  QObject::connect(m_removeFilterButton, SIGNAL(clicked(void)), this, SLOT(removeFilter(void)));
173  QObject::connect(m_configureFilterButton, SIGNAL(clicked(void)), this, SLOT(configureFilter(void)));
174  QObject::connect(m_splitFilterButton, SIGNAL(clicked(void)), this, SLOT(splitFilter(void)));
175  QObject::connect(m_applyFiltersButton, SIGNAL(clicked(void)), this, SLOT(applyFilters(void)));
176  QObject::connect(m_deleteShortcut, SIGNAL(activated()), this, SLOT(removeFilter(void)));
177  QObject::connect(m_selectedFilterListWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this,
178  SLOT(showContextMenuForSelectedFilter(const QPoint&)));
179  QObject::connect(m_forcedApplyCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onForceChecked(int)));
180 }
181 
182 //------------------------------------------------------------------------------
183 
184 void SFilterSelectionEditor::onForceChecked(int state)
185 {
186  if(state == Qt::Checked)
187  {
189  "Be careful",
190  "You asked to ignore reading errors, there are high risks of issues for resulting image.",
191  ::fwGui::dialog::IMessageDialog::WARNING);
192  }
193 }
194 
195 //------------------------------------------------------------------------------
196 
198 {
199  unsigned int index = 0;
200 
201  std::vector< ::fwDicomIOFilter::IFilter::sptr > sortedFilters;
202  for(const std::string& key: ::fwDicomIOFilter::registry::get()->getFactoryKeys())
203  {
204  ::fwDicomIOFilter::IFilter::sptr filter = ::fwDicomIOFilter::factory::New(key);
205  sortedFilters.push_back(filter);
206  }
207 
208  std::sort(sortedFilters.begin(), sortedFilters.end(), SFilterSelectionEditor::sortFilters);
209 
210  for(const ::fwDicomIOFilter::IFilter::sptr& filter: sortedFilters)
211  {
212  // If the filter doesn't have a configuration or if it is configurable using GUI
213  if(!filter->isConfigurationRequired() || filter->isConfigurableWithGUI())
214  {
215  // Create filter
216  m_availableFilterListWidget->addItem(filter->getName().c_str(), filter->getClassname().c_str());
217 
218  // Set icon
219  m_availableFilterListWidget->setItemIcon(index, SFilterSelectionEditor::getFilterIcon(filter));
220 
221  // Set description
222  m_availableFilterListWidget->setItemData(index,
223  SFilterSelectionEditor::getFilterDescription(
224  filter).c_str(), Qt::ToolTipRole);
225 
226  ++index;
227  }
228  }
229 }
230 
231 //------------------------------------------------------------------------------
232 
234 {
235  SLM_TRACE_FUNC();
236 
237  // Disconnect the signals
238  QObject::disconnect(m_selectedFilterListWidget, SIGNAL(currentRowChanged(int)), this,
239  SLOT(updateButtonStatus(int)));
240  QObject::disconnect(m_addFilterButton, SIGNAL(clicked(void)), this, SLOT(addFilterAtTheEnd(void)));
241  QObject::disconnect(m_removeFilterButton, SIGNAL(clicked(void)), this, SLOT(removeFilter(void)));
242  QObject::disconnect(m_configureFilterButton, SIGNAL(clicked(void)), this, SLOT(configureFilter(void)));
243  QObject::disconnect(m_splitFilterButton, SIGNAL(clicked(void)), this, SLOT(splitFilter(void)));
244  QObject::disconnect(m_applyFiltersButton, SIGNAL(clicked(void)), this, SLOT(applyFilters(void)));
245  QObject::disconnect(m_deleteShortcut, SIGNAL(activated()), this, SLOT(removeFilter(void)));
246  QObject::disconnect(m_selectedFilterListWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this,
247  SLOT(showContextMenuForSelectedFilter(const QPoint&)));
248 
249  this->destroy();
250 }
251 
252 //------------------------------------------------------------------------------
253 
255 {
256 }
257 
258 //------------------------------------------------------------------------------
259 
260 void SFilterSelectionEditor::addFilter(int filterTypeIndex)
261 {
262  int index = m_selectedFilterListWidget->currentRow()+1;
263  this->addFilter(filterTypeIndex, index);
264 }
265 
266 //------------------------------------------------------------------------------
267 
268 void SFilterSelectionEditor::addFilterAtTheEnd()
269 {
270  this->addFilter(m_availableFilterListWidget->currentIndex(), m_selectedFilterListWidget->count());
271 }
272 
273 //------------------------------------------------------------------------------
274 
275 void SFilterSelectionEditor::addFilter(int filterTypeIndex, int position)
276 {
277  // Get information from selected filter
278  QIcon icon = m_availableFilterListWidget->itemIcon(filterTypeIndex);
279  QString name = m_availableFilterListWidget->itemText(filterTypeIndex);
280  QString description = m_availableFilterListWidget->itemData(filterTypeIndex, Qt::ToolTipRole).toString();
281  std::string key = m_availableFilterListWidget->itemData(filterTypeIndex).toString().toStdString();
282 
283  // Create filter
284  ::fwDicomIOFilter::IFilter::sptr filter = ::fwDicomIOFilter::factory::New(key);
285  std::string id = filter->getID();
286  m_filtersMap[id] = filter;
287 
288  // Add a the filter in the list
289  m_selectedFilterListWidget->insertItem(position, name);
290  m_selectedFilterListWidget->item(position)->setIcon(icon);
291  m_selectedFilterListWidget->item(position)->setToolTip(description);
292  m_selectedFilterListWidget->item(position)->setData(Qt::UserRole, id.c_str());
293  m_selectedFilterListWidget->setCurrentRow(position);
294 
295  // Update apply button
296  m_applyFiltersButton->setEnabled(m_selectedFilterListWidget->count() > 0);
297 }
298 
299 //------------------------------------------------------------------------------
300 
301 void SFilterSelectionEditor::removeFilter()
302 {
303  int currentIndex = m_selectedFilterListWidget->currentRow();
304  if(currentIndex >= 0)
305  {
306  // Remove selected filter from map
307  std::string id = m_selectedFilterListWidget->item(currentIndex)->data(Qt::UserRole).toString().toStdString();
308  m_filtersMap.erase(id);
309 
310  // Remove selected filter from widget
311  m_selectedFilterListWidget->takeItem(currentIndex);
312  }
313 }
314 
315 //------------------------------------------------------------------------------
316 
317 void SFilterSelectionEditor::configureFilter()
318 {
319  int selectedFilterIndex = m_selectedFilterListWidget->currentRow();
320  std::string id =
321  m_selectedFilterListWidget->item(selectedFilterIndex)->data(Qt::UserRole).toString().toStdString();
322  m_filtersMap[id]->configureWithGUI();
323 }
324 
325 //------------------------------------------------------------------------------
326 
327 void SFilterSelectionEditor::splitFilter()
328 {
329  int currentIndex = m_selectedFilterListWidget->currentRow();
330  std::string compositeId =
331  m_selectedFilterListWidget->item(currentIndex)->data(Qt::UserRole).toString().toStdString();
332  ::fwDicomIOFilter::composite::IComposite::sptr composite =
333  ::fwDicomIOFilter::composite::IComposite::dynamicCast(m_filtersMap[compositeId]);
334 
335  // Remove composite filter
336  this->removeFilter();
337 
338  // Add filters
339  int position = currentIndex;
340  for(const ::fwDicomIOFilter::IFilter::sptr& filter: composite->getChildren())
341  {
342  std::string id = filter->getID();
343  m_filtersMap[id] = filter;
344  m_selectedFilterListWidget->insertItem(position, filter->getName().c_str());
345  m_selectedFilterListWidget->item(position)->setIcon(SFilterSelectionEditor::getFilterIcon(filter));
346  m_selectedFilterListWidget->item(position)->setToolTip(
347  SFilterSelectionEditor::getFilterDescription(filter).c_str());
348  m_selectedFilterListWidget->item(position)->setData(Qt::UserRole, id.c_str());
349  ++position;
350  }
351  m_selectedFilterListWidget->setCurrentRow(currentIndex);
352 
353 }
354 
355 //------------------------------------------------------------------------------
356 
357 void SFilterSelectionEditor::updateButtonStatus(int filterIndex)
358 {
359  bool hasFilter = (filterIndex != -1);
360  m_removeFilterButton->setEnabled(hasFilter);
361  if(hasFilter)
362  {
363  std::string id = m_selectedFilterListWidget->item(filterIndex)->data(Qt::UserRole).toString().toStdString();
364 
365  // Configure filter button
366  m_configureFilterButton->setEnabled(m_filtersMap[id]->isConfigurableWithGUI());
367 
368  // Split filter button
369  m_splitFilterButton->setEnabled(m_filtersMap[id]->getFilterType() == ::fwDicomIOFilter::IFilter::COMPOSITE);
370  }
371  else
372  {
373  m_configureFilterButton->setEnabled(false);
374  m_splitFilterButton->setEnabled(false);
375  }
376 }
377 
378 //------------------------------------------------------------------------------
379 
380 void SFilterSelectionEditor::applyFilters()
381 {
382  typedef std::vector< ::fwMedData::DicomSeries::sptr > DicomSeriesContainertype;
383  typedef std::vector< ::fwDicomIOFilter::IFilter::sptr > FilterContainertype;
384 
385  // Get selected DicomSeries
386  ::fwData::Vector::csptr vector = this->getInput< ::fwData::Vector >("selection");
387  SLM_ASSERT("Vector object should not be null.", vector);
388 
389  // Display the informations
391  messageBox.setIcon(::fwGui::dialog::IMessageDialog::INFO);
392  messageBox.addButton(::fwGui::dialog::IMessageDialog::OK);
393  messageBox.setTitle("Filters information");
394 
395  // Clear destination SeriesDB
397  sDBhelper.clear();
398 
399  // Be sure series are selected
400  if(vector->empty())
401  {
402  messageBox.setMessage("You must select series on which you want to apply your filters.");
403  }
404  else if(m_selectedFilterListWidget->count() == 0)
405  {
406  messageBox.setMessage("You must select the filters that you want to apply on your series.");
407  }
408  else
409  {
410  // Create containers
411  DicomSeriesContainertype dicomSeriesContainer;
412  FilterContainertype filterContainer;
413 
414  // Copy selected DicomSeries
415  for(const ::fwData::Object::sptr& obj: vector->getContainer())
416  {
417  ::fwMedData::DicomSeries::sptr srcDicomSeries = ::fwMedData::DicomSeries::dynamicCast(obj);
418  SLM_ASSERT("The series should be a DicomSeries.", srcDicomSeries);
419 
420  ::fwMedData::DicomSeries::sptr dicomSeries = ::fwMedData::DicomSeries::New();
421  dicomSeries->deepCopy(srcDicomSeries);
422  dicomSeriesContainer.push_back(dicomSeries);
423  }
424 
425  // Create filter vector
426  for(int i = 0; i < m_selectedFilterListWidget->count(); ++i)
427  {
428  std::string id = m_selectedFilterListWidget->item(i)->data(Qt::UserRole).toString().toStdString();
429  filterContainer.push_back(m_filtersMap[id]);
430  }
431 
432  std::stringstream ssFilters;
433  std::stringstream ssInfos;
434  bool forcedApply = m_forcedApplyCheckBox->isChecked();
435 
436  ssFilters << "<b>Filters :</b><br />";
437  // Let's apply all the filters
438  for(const ::fwDicomIOFilter::IFilter::sptr& filter: filterContainer)
439  {
440  ssFilters << "- " << filter->getName() << " -> ";
441  try
442  {
443  ::fwDicomIOFilter::helper::Filter::applyFilter(dicomSeriesContainer, filter, forcedApply);
444  ssFilters << "<font color=\"Green\">OK</font><br />";
445  }
447  {
448  ssFilters << "<font color=\"Red\">ERROR</font><br />";
449  ssInfos << "- " << e.what() << "<br />";
450  if(!forcedApply)
451  {
452  break;
453  }
454  }
455  }
456 
457  // Push series
458  if(forcedApply || ssInfos.str().empty())
459  {
460  // Add filtered series to SeriesDB
461  for(const ::fwMedData::DicomSeries::sptr& series: dicomSeriesContainer)
462  {
463  sDBhelper.add(series);
464  }
465  }
466 
467  // If there is no error
468  if(ssInfos.str().empty())
469  {
470  ssInfos << "All filters have been correctly applied.";
471  }
472 
473  std::string msg = ssFilters.str() + "<br /><br /><b>Informations :</b><br />" + ssInfos.str();
474  messageBox.setMessage(msg);
475  }
476 
477  // Diplay message
478  messageBox.show();
479 
480  // Notify
481  sDBhelper.notify();
482 
483 }
484 
485 //------------------------------------------------------------------------------
486 
487 void SFilterSelectionEditor::showContextMenuForSelectedFilter(const QPoint& pos)
488 {
489  // Create context menu
490  QMenu contextMenu("Context menu", m_selectedFilterListWidget);
491 
492  // Add menu
493  QMenu* addMenu = contextMenu.addMenu("Add");
494 
495  // Use a mapper to retrieve index of the selected filter type
496  QPointer< QSignalMapper > mapper = new QSignalMapper();
497 
498  // Fill the menu with the available filters
499  for(int i = 0; i < m_availableFilterListWidget->count(); ++i)
500  {
501  QString text = m_availableFilterListWidget->itemText(i);
502  QIcon icon = m_availableFilterListWidget->itemIcon(i);
503  QPointer< QAction > action = new QAction(icon, text, m_selectedFilterListWidget);
504  action->setIconVisibleInMenu(true);
505  addMenu->addAction(action);
506 
507  mapper->setMapping(action, i);
508  QObject::connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
509  }
510 
511  // Connect mapper
512  QObject::connect(mapper, SIGNAL(mapped(int)), this, SLOT(addFilter(int)));
513 
514  // Check id the menu is requested from a filter
515  QListWidgetItem* filterItem = m_selectedFilterListWidget->itemAt(pos);
516  if(filterItem)
517  {
518  // Get filter
519  std::string id = filterItem->data(Qt::UserRole).toString().toStdString();
520  ::fwDicomIOFilter::IFilter::sptr filter = m_filtersMap[id];
521 
522  // Remove action
523  QPointer< QAction > removeAction = new QAction("Remove", m_selectedFilterListWidget);
524  QObject::connect(removeAction, SIGNAL(triggered()), this, SLOT(removeFilter()));
525  contextMenu.addAction(removeAction);
526 
527  // Configure action
528  QPointer< QAction > configureAction = new QAction("Configure", m_selectedFilterListWidget);
529  configureAction->setEnabled(filter->isConfigurableWithGUI());
530  QObject::connect(configureAction, SIGNAL(triggered()), this, SLOT(configureFilter()));
531  contextMenu.addAction(configureAction);
532 
533  // Split action
534  QPointer< QAction > splitAction = new QAction("Split", m_selectedFilterListWidget);
535  splitAction->setEnabled(filter->getFilterType() == ::fwDicomIOFilter::IFilter::COMPOSITE);
536  QObject::connect(splitAction, SIGNAL(triggered()), this, SLOT(splitFilter()));
537  contextMenu.addAction(splitAction);
538 
539  }
540 
541  // Display menu
542  contextMenu.exec(m_selectedFilterListWidget->mapToGlobal(pos));
543 
544 }
545 
546 //------------------------------------------------------------------------------
547 
548 bool SFilterSelectionEditor::sortFilters(const ::fwDicomIOFilter::IFilter::sptr& a,
549  const ::fwDicomIOFilter::IFilter::sptr& b)
550 {
551  if(a->getFilterType() == b->getFilterType())
552  {
553  return a->getName() < b->getName();
554  }
555  return a->getFilterType() > b->getFilterType();
556 }
557 
558 //------------------------------------------------------------------------------
559 
560 QIcon SFilterSelectionEditor::getFilterIcon(::fwDicomIOFilter::IFilter::sptr filter)
561 {
562  const ::boost::filesystem::path path = ::fwRuntime::getBundleResourcePath(std::string("media"));
563  QIcon icons[] = {
564  QIcon(QString::fromStdString((path / "icons/Modifier.svg").string())),
565  QIcon(QString::fromStdString((path / "icons/Sorter.svg").string())),
566  QIcon(QString::fromStdString((path / "icons/Splitter.svg").string())),
567  QIcon(QString::fromStdString((path / "icons/Composite.svg").string())),
568  QIcon(QString::fromStdString((path / "icons/Custom.svg").string()))
569  };
570  return icons[filter->getFilterType()];
571 }
572 
573 //------------------------------------------------------------------------------
574 
575 std::string SFilterSelectionEditor::getFilterDescription(::fwDicomIOFilter::IFilter::sptr filter)
576 {
577  std::string types[] = { "Modifier", "Sorter", "Splitter", "Composite", "Custom" };
578  std::string description =
579  "<b>Name :</b> "+filter->getName()+"<br />"
580  "<b>Type :</b> "+types[filter->getFilterType()]+"<br />"
581  "<b>Configurable :</b> "+((filter->isConfigurableWithGUI()) ? "Yes" : "No")+"<br />"
582  "<b>Informations :</b><br />"+filter->getDescription();
583  return description;
584 }
585 
586 //------------------------------------------------------------------------------
587 
588 } // namespace ioDicom
#define SLM_TRACE_FUNC()
Trace contextual function signature.
Definition: spyLog.hpp:329
virtual FWGUI_API void setMessage(const std::string &msg) override
Set the message.
Defines the service interface managing the editor service for object.
Definition: IEditor.hpp:25
Defines the generic message box for IHM. Use the Delegate design pattern.
static FWGUI_API IMessageDialog::Buttons showMessageDialog(const std::string &title, const std::string &message,::fwGui::dialog::IMessageDialog::Icons icon=INFO)
FWGUI_API void destroy()
Stops sub-views and toobar services. Destroys view, sub-views and toolbar containers.
QPointer< QPushButton > m_splitFilterButton
Button used to split a composite filter.
QPointer< QListWidget > m_selectedFilterListWidget
Selected filters list widget.
QPointer< QComboBox > m_availableFilterListWidget
Combo box displaying the available filters.
FWMEDDATATOOLS_API void add(::fwMedData::Series::sptr newSeries)
Add a Series in the SeriesDB.
FilterMapType m_filtersMap
Map used to store filters and their keys.
IODICOM_API void fillAvailableFilters()
Fill the combobox with the list of available filters.
Defines an helper to modify an fwMedData::SeriesDB and create in parallel the message to announce thi...
QPointer< QPushButton > m_applyFiltersButton
Button used to apply filters of the list.
::fwMedData::SeriesDB::sptr m_destinationSeriesDB
Destination SeriesDB.
static FWDICOMIOFILTER_API bool applyFilter(DicomSeriesContainerType &dicomSeriesContainer,::fwDicomIOFilter::IFilter::sptr filter, bool forcedApply=false, const ::fwLog::Logger::sptr &logger=::fwLog::Logger::New())
Apply a filter to the DicomSeries.
Definition: Filter.cpp:17
virtual IODICOM_API void stopping() override
Override.
This editor service is used to select and apply filters to Dicom series.
virtual IODICOM_API void starting() override
Override.
This class defines a vector of objects.
virtual FWGUI_API void addButton(IMessageDialog::Buttons button) override
Add a button (OK, YES_NO, YES, NO, CANCEL)
FWMEDDATATOOLS_API void clear()
Clear all series in the SeriesDB.
virtual FWGUI_API IMessageDialog::Buttons show() override
Show the message box and return the clicked button.
QPointer< QPushButton > m_configureFilterButton
Button used to configure a filter in the list.
ioDicom contains services used to deal with the DICOM standard.
#define SLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:308
QPointer< QPushButton > m_removeFilterButton
Button used to remove a filter in the list.
FWGUI_API void create()
Creates view, sub-views and toolbar containers. Manages sub-views and toobar services.
virtual FWGUI_API void setIcon(IMessageDialog::Icons icon) override
Set the icon (CRITICAL, WARNING, INFO or QUESTION)
static bool sortFilters(const ::fwDicomIOFilter::IFilter::sptr &a, const ::fwDicomIOFilter::IFilter::sptr &b)
Sort filters.
QPointer< QShortcut > m_deleteShortcut
Delete key shortcut.
IODICOM_API void info(std::ostream &_sstream) override
Override.
IODICOM_API SFilterSelectionEditor() noexcept
Constructor.
FWMEDDATATOOLS_API void notify()
Send the signal of modification.
IODICOM_API void updating() override
Override.
virtual IODICOM_API void configuring() override
Do nothing.
QPointer< QPushButton > m_addFilterButton
Button used to add a filter in the list.
std::string m_destinationSeriesDBID
Destination SeriesDB ID.
virtual IODICOM_API ~SFilterSelectionEditor() noexcept
Destructor.
QPointer< QCheckBox > m_forcedApplyCheckBox
Forced apply check box.
virtual FWGUI_API void setTitle(const std::string &title) override
Set the title of the message box.
FWGUI_API void initialize()
Initialize managers.