Segment Anything Model Python process handler class.
More...
#include <mitkSegmentAnythingPythonService.h>
|
| mitkClassMacroItkParent (SegmentAnythingPythonService, itk::Object) |
|
| SegmentAnythingPythonService (std::string workingDir, std::string modelType, std::string checkPointPath, unsigned int gpuId, std::string backend) |
| Construct a new Segment Anything Python Service object. Specify working directory, ViT model type, checkpoint path, gpu id and backend. More...
|
|
| ~SegmentAnythingPythonService () |
| Destroy the Segment Anything Python Service object. Stop the async python process and deletes temporary directories. More...
|
|
virtual void | SetMitkTempDir (std::string _arg) |
|
virtual std::string | GetMitkTempDir () const |
|
| mitkNewMacro5Param (SegmentAnythingPythonService, std::string, std::string, std::string, unsigned int, std::string) |
|
void | StartAsyncProcess () |
| Creates temp directories and calls start_python_daemon function async. More...
|
|
void | StopAsyncProcess () |
| Writes KILL to the control file to stop the daemon process. More...
|
|
void | TransferImageToProcess (const Image *inputAtTimeStep, std::string &UId) |
| Writes image as nifity file with unique id (UId) as file name. More...
|
|
void | TransferPointsToProcess (const std::string &triggerCSV) const |
| Writes csv stringstream of points to a csv file for python daemon to read. More...
|
|
LabelSetImage::Pointer | RetrieveImageFromProcess (long timeOut=-1) const |
| Waits for output nifity file from the daemon to appear and reads it as a mitk::Image. More...
|
|
|
static void | onPythonProcessEvent (itk::Object *, const itk::EventObject &, void *) |
| Static function to print out everything from itk::EventObject. Used as callback in mitk::ProcessExecutor object. More...
|
|
static bool | CheckStatus () |
| Checks CurrentStatus enum variable and returns true if daemon is READY (to read files) state, false is OFF state or throws exception if daemon is found KILL or Cuda error state. More...
|
|
Segment Anything Model Python process handler class.
Definition at line 31 of file mitkSegmentAnythingPythonService.h.
◆ Status
◆ SegmentAnythingPythonService()
mitk::SegmentAnythingPythonService::SegmentAnythingPythonService |
( |
std::string |
workingDir, |
|
|
std::string |
modelType, |
|
|
std::string |
checkPointPath, |
|
|
unsigned int |
gpuId, |
|
|
std::string |
backend |
|
) |
| |
Construct a new Segment Anything Python Service object. Specify working directory, ViT model type, checkpoint path, gpu id and backend.
- Parameters
-
workingDir | of python process |
modelType | of ViT |
checkPointPath | of specified model type |
gpuId | |
backend | SAM or MedSAM |
◆ ~SegmentAnythingPythonService()
mitk::SegmentAnythingPythonService::~SegmentAnythingPythonService |
( |
| ) |
|
Destroy the Segment Anything Python Service object. Stop the async python process and deletes temporary directories.
◆ CheckStatus()
static bool mitk::SegmentAnythingPythonService::CheckStatus |
( |
| ) |
|
|
static |
Checks CurrentStatus enum variable and returns true if daemon is READY (to read files) state, false is OFF state or throws exception if daemon is found KILL or Cuda error state.
- Returns
- bool
◆ GetMitkTempDir()
virtual std::string mitk::SegmentAnythingPythonService::GetMitkTempDir |
( |
| ) |
const |
|
virtual |
◆ mitkClassMacroItkParent()
◆ mitkNewMacro5Param()
mitk::SegmentAnythingPythonService::mitkNewMacro5Param |
( |
SegmentAnythingPythonService |
, |
|
|
std::string |
, |
|
|
std::string |
, |
|
|
std::string |
, |
|
|
unsigned int |
, |
|
|
std::string |
|
|
) |
| |
◆ onPythonProcessEvent()
static void mitk::SegmentAnythingPythonService::onPythonProcessEvent |
( |
itk::Object * |
, |
|
|
const itk::EventObject & |
, |
|
|
void * |
|
|
) |
| |
|
static |
Static function to print out everything from itk::EventObject. Used as callback in mitk::ProcessExecutor object.
◆ RetrieveImageFromProcess()
LabelSetImage::Pointer mitk::SegmentAnythingPythonService::RetrieveImageFromProcess |
( |
long |
timeOut = -1 | ) |
const |
◆ SetMitkTempDir()
virtual void mitk::SegmentAnythingPythonService::SetMitkTempDir |
( |
std::string |
_arg | ) |
|
|
virtual |
◆ StartAsyncProcess()
void mitk::SegmentAnythingPythonService::StartAsyncProcess |
( |
| ) |
|
Creates temp directories and calls start_python_daemon function async.
◆ StopAsyncProcess()
void mitk::SegmentAnythingPythonService::StopAsyncProcess |
( |
| ) |
|
Writes KILL to the control file to stop the daemon process.
◆ TransferImageToProcess()
void mitk::SegmentAnythingPythonService::TransferImageToProcess |
( |
const Image * |
inputAtTimeStep, |
|
|
std::string & |
UId |
|
) |
| |
Writes image as nifity file with unique id (UId) as file name.
◆ TransferPointsToProcess()
void mitk::SegmentAnythingPythonService::TransferPointsToProcess |
( |
const std::string & |
triggerCSV | ) |
const |
Writes csv stringstream of points to a csv file for python daemon to read.
◆ CurrentStatus
Status mitk::SegmentAnythingPythonService::CurrentStatus |
|
static |
The documentation for this class was generated from the following file: