13 #ifndef mitkSegmentAnythingPythonService_h
14 #define mitkSegmentAnythingPythonService_h
44 itkSetMacro(MitkTempDir, std::string);
45 itkGetConstMacro(MitkTempDir, std::string);
52 static void onPythonProcessEvent(itk::Object*,
const itk::EventObject&,
void*);
61 static bool CheckStatus() ;
68 void StartAsyncProcess();
74 void StopAsyncProcess();
80 void TransferImageToProcess(
const Image*, std::string &UId);
87 void TransferPointsToProcess(std::stringstream&);
104 void start_python_daemon();
110 void WriteControlFile(std::stringstream&);
116 void CreateTempDirs(
const std::string&);
122 template <
typename TPixel,
unsigned int VImageDimension>
123 void ITKWriter(
const itk::Image<TPixel, VImageDimension> *image, std::string& outputFilename);
126 std::string m_MitkTempDir;
127 std::string m_PythonPath;
128 std::string m_ModelType;
129 std::string m_CheckpointPath;
130 std::string m_InDir, m_OutDir;
131 std::string m_CurrentUId;
133 const std::string PARENT_TEMP_DIR_PATTERN =
"mitk-sam-XXXXXX";
134 const std::string TRIGGER_FILENAME =
"trigger.csv";
135 const std::string SAM_PYTHON_FILE_NAME =
"run_inference_daemon.py";
136 std::future<void> m_Future;
144 static const std::string
OFF;