Skip to content

Studio/ShapeWorksMONAI/MonaiLabelTool.h

Namespaces

Name
shapeworks
User usage reporting (telemetry)
monailabel

Classes

Name
class monailabel::MonaiLabelTool

Source code

#pragma once

#include <Data/Preferences.h>
#include <Data/Session.h>
#include <Project.h>
#include <Shape.h>
#include <ShapeWorksMONAI/MonaiLabelJob.h>
#include <Interface/ShapeWorksStudioApp.h>

#include <QElapsedTimer>
#include <QObject>
#include <QSharedPointer>
#include <QWidget>

class Ui_MonaiLabelTool;
class QLabel;
class QTableWidget;
class QLineEdit;
class Preferences;

namespace shapeworks {
class ShapeWorksStudioApp;
class Session;
}
namespace monailabel {

class MonaiLabelJob;
using shapeworks::ShapeWorksStudioApp;
using shapeworks::Session;
class MonaiLabelTool : public QWidget {
  Q_OBJECT;

 public:
  const static std::string MONAI_MODE_SEGMENTATION;
  const static std::string MONAI_MODE_DEEPGROW;
  const static std::string MONAI_MODE_DEEPEDIT;
  const static std::string MONAI_SAMPLE_STRATEGY_RANDOM;


  MonaiLabelTool(Preferences& prefs);
  ~MonaiLabelTool();

  void set_session(QSharedPointer<Session> session);
  void set_app(ShapeWorksStudioApp* app);
  bool is_active();
  void loadParamsFromUi();
  void shutdown();
  void runSegmentationTool();
  void resizeEvent(QResizeEvent* event) override;
  int getCurrentSampleNumber();
  void enable_actions();

 public Q_SLOTS:
  void handle_error(QString msg);
  void onConnectServer();
  void onServerAddressChanged();
  void onModelTypeChanged(int index);
  void triggerUpdateView();
  void handle_progress(int val, QString message);
  void handleSampleNumberChanged();
  void handleClientInitialized();
  void handleUploadSampleCompleted();
  void handleSegmentationCompleted();
  void handleSubmitLabelCompleted();

 Q_SIGNALS:
  void update_view();
  void progress(int);
  void sampleChanged();

 private:
  Preferences& preferences_;
  Ui_MonaiLabelTool* ui_;
  QSharedPointer<Session> session_;
  ShapeWorksStudioApp* app_;
  bool tool_is_running_ = false;
  QSharedPointer<MonaiLabelJob> monai_label_logic_;
  QElapsedTimer timer_;

  std::string server_address_;
  std::string model_type_;
  std::string strategy_;
  std::string client_id_;
  int samples_processed_ = 0;

};

}  // namespace monailabel

Updated on 2024-11-11 at 19:51:46 +0000