12 #ifndef mitkMonaiLabelTool_h
13 #define mitkMonaiLabelTool_h
18 #include <unordered_map>
20 #include <nlohmann/json.hpp>
39 std::unordered_map<std::string, int>
labels;
42 std::unordered_map<bool, std::string>
config;
46 return (this->name == rhs.
name && this->type == rhs.
type);
51 return (
"deepgrow" ==
type ||
"deepedit" ==
type);
87 return (this->model == rhs.
model && this->hostName == rhs.
hostName && this->port == rhs.
port &&
143 itkSetMacro(ModelName, std::string);
144 itkGetConstMacro(ModelName, std::string);
145 itkSetMacro(URL, std::string);
146 itkGetConstMacro(URL, std::string);
147 itkSetMacro(TempDir, std::string);
148 itkGetConstMacro(TempDir, std::string);
149 itkSetMacro(Timeout,
unsigned int);
150 itkGetConstMacro(Timeout,
unsigned int);
208 const PointSet::Pointer pointSet)
const;
219 int m_PointSetCount = 0;
226 std::unique_ptr<MonaiAppMetadata> m_InfoParameters;
232 std::pair<std::string, std::string> CreateTempDirs(
const std::string &filePattern)
const;
237 bool IsMonaiServerOn(
const std::string &hostName,
const int &port)
const;
242 mitk::Image::Pointer ApplyLevelWindowEffect(
const Image *inputAtTimeStep)
const;
247 void PostInferRequest(
const std::string &hostName,
const int &port,
const std::string &filePath,
const std::string &outFile,
250 std::string m_TempDir;
251 std::string m_ModelName;
254 unsigned int m_Timeout = 60;
255 const std::set<std::string> m_AUTO_SEG_TYPE_NAME = {
"segmentation"};
256 const std::set<std::string> m_SCRIBBLE_SEG_TYPE_NAME = {
"scribbles"};
257 const std::set<std::string> m_INTERACTIVE_SEG_TYPE_NAME = {
"deepgrow"};
258 const std::string m_TEMPLATE_FILENAME =
"XXXXXX_000_0000.nii.gz";
259 const std::string m_SERVER_503_ERROR_TEXT =
"A connection to MonaiLabel server cannot be established.";
#define MITKSEGMENTATION_EXPORT
Abstract base class describing the geometry of a data object.
Image class for storing multi-dimensional medical image data.
Base class for all interaction events in MITK.
unsigned short PixelType
Pixel type used for label values (unsigned short).
AlgorithmType
Enumeration describing how a label was created or refined.
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
Represents an action that is executed after a certain event in the state machine mechanism.
Find image slices visible on a given plane.
std::size_t TimeStepType
Type for time step indices (non-negative integers starting from 0).
Request class encapsulating model and server information for a MonaiLabel inference request.
bool operator==(const MonaiLabelRequest &rhs) const
Struct holding metadata for a single MonaiLabel model.
bool IsInteractive() const
std::unordered_map< std::string, int > labels
bool operator==(const MonaiModelInfo &rhs) const
std::unordered_map< bool, std::string > config