/*========================================================================= medInria Copyright (c) INRIA 2013 - 2019. All rights reserved. See LICENSE.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =========================================================================*/ #pragma once // medInria #include #include #include #include #include #include #include #include class baseViewEvent; class medContours; /*! \brief Toolbox to create, use, interpolate Polygon ROI. * * This toolbox has several named widgets which can be accessed in python pipelines:\n\n * "closedPolygonButton" : QPushButton\n * "interpolateButton" : QPushButton\n * "extractRoiButton" : QPushButton\n * "repulsorTool" : QPushButton\n * "generateBinaryImageButton" : QPushButton */ class POLYGONROIPLUGIN_EXPORT polygonRoiToolBox : public medAbstractSelectableToolBox { Q_OBJECT MED_TOOLBOX_INTERFACE("Polygon Roi", "Used to create Polygon ROI", <<"Segmentation") public: static const char *generateBinaryImageButtonName; typedef QPair PlaneIndexSlicePair; explicit polygonRoiToolBox( QWidget *parent ); ~polygonRoiToolBox() override; static bool registered(); dtkPlugin* plugin() override; medAbstractData *processOutput() override; QList > processOutputs() override; void drawCross(double *position); void eraseCross(); QPushButton *repulsorTool; public slots: void updateView() override; void clickClosePolygon(bool state); void activateRepulsor(bool state); void interpolateCurve(bool state); void showHelp() const; private slots: void disableButtons(); void saveContours(); void saveBinaryImage(); void onLayerRemoveOnOrientedViews(medAbstractData *data); void onLayerRemoved(medAbstractData *data); void onDataIndexActivated(); void clear() override; private: QHash viewEventHash; medAbstractData* activeData; qint32 specialityPreference; medToolBox *pMedToolBox; QPushButton *activateTBButton; QPushButton *saveBinaryMaskButton; QCheckBox *interpolate; QPushButton *saveContourButton; QPushButton *helpButton; QLabel *repulsorLabel; QLabel *saveLabel; void createAndConnectEventFilter(const medAbstractData *data, medAbstractImageView *imageView); QList getITKImageDataInSelectedView(medAbstractView *view); QList getContoursInSelectedView(medAbstractView *view); void highLightContainer(medAbstractView *pView); };