12 #ifndef mitkMonaiLabelTool_h
13 #define mitkMonaiLabelTool_h
18 #include <unordered_map>
20 #include <nlohmann/json.hpp>
40 std::unordered_map<std::string, int>
labels;
43 std::unordered_map<bool, std::string>
config;
47 return (this->name == rhs.
name && this->type == rhs.
type);
52 return (
"deepgrow" ==
type ||
"deepedit" ==
type);
91 return (this->model == rhs.
model && this->hostName == rhs.
hostName && this->port == rhs.
port &&
109 void Activated()
override;
110 void Deactivated()
override;
111 void UpdatePrepare()
override;
117 void FetchOverallInfo(
const std::string &hostName,
const int &port);
129 const std::vector<MonaiModelInfo> GetAutoSegmentationModels(
const int dim = -1)
const;
135 const std::vector<MonaiModelInfo> GetInteractiveSegmentationModels(
const int dim = -1)
const;
141 const std::vector<MonaiModelInfo> GetScribbleSegmentationModels(
const int dim = -1)
const;
148 itkSetMacro(ModelName, std::string);
149 itkGetConstMacro(ModelName, std::string);
150 itkSetMacro(URL, std::string);
151 itkGetConstMacro(URL, std::string);
152 itkSetMacro(TempDir, std::string);
153 itkGetConstMacro(TempDir, std::string);
166 bool HasPicks()
const;
174 void ConnectActionsAndFunctions()
override;
180 virtual void WriteImage(
const Image *,
const std::string &)
const = 0;
218 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;
249 void PostInferRequest(
const std::string &hostName,
const int &port,
const std::string &filePath,
const std::string &outFile,
252 std::string m_TempDir;
253 std::string m_ModelName;
256 const std::set<std::string> m_AUTO_SEG_TYPE_NAME = {
"segmentation"};
257 const std::set<std::string> m_SCRIBBLE_SEG_TYPE_NAME = {
"scribbles"};
258 const std::set<std::string> m_INTERACTIVE_SEG_TYPE_NAME = {
"deepgrow"};
259 const std::string m_TEMPLATE_FILENAME =
"XXXXXX_000_0000.nii.gz";
260 const std::string m_SERVER_503_ERROR_TEXT =
"A connection to MonaiLabel server cannot be established.";