ImFusion C++ SDK 4.4.0
ImFusion::WatershedComputer Class Reference
Inheritance diagram for ImFusion::WatershedComputer:

Public Types

enum  State { Idle , Computing , Exited }
enum  StopReason {
  NoSource , NoSeeds , IncompatibleSourceSeeds , CheckFailed ,
  CancelRequest , PostProcessFailed , Success
}
using GenerateImageFunction = std::function<std::unique_ptr<TypedImage<unsigned char>>(Progress*)>
using CheckFunction = std::function<int(const TypedImage<unsigned char>& source, const TypedImage<unsigned char>& seeds)>
using PostProcessFunction = std::function<bool(std::unique_ptr<TypedImage<unsigned char>>&)>
Public Types inherited from ImFusion::NestedProgress
enum  TaskMode { Default = 0 , ThreadSafe = 1 << 0 , Hidden = 1 << 1 }
 Enumeration of possible invariants that should be ensured by NestedProgress. More...

Public Member Functions

void setSource (std::unique_ptr< TypedImage< unsigned char > > source)
void setSeeds (std::unique_ptr< TypedImage< unsigned char > > seeds)
void setROI (const vec3i &lowerLeftFront, const vec3i &upperRightBack)
void setSourceFunc (GenerateImageFunction func)
void setSeedsFunc (GenerateImageFunction func)
void setCheckFunction (CheckFunction func)
void setPostProcess (PostProcessFunction func)
void start (bool wait=false)
 if wait is true, blocks until the worker thread has acknowledged the start
bool cancel (bool wait=false)
 returns false if the worker thread was not Computing if wait is true, blocks until the worker thread has acknowledged the cancellation
State state () const
std::unique_ptr< TypedImage< unsigned char > > getResult (bool wait=false)
 returns the result of the past watershed computation
Public Member Functions inherited from ImFusion::NestedProgress
 NestedProgress (Progress *parent=nullptr, Flags< TaskMode > taskFlags=TaskMode::Default)
 Creates a new NestedProgress instance.
void setParentProgress (Progress *parent)
 Updates the parent Progress instance to which progress updates should be forwarded to.
void cancelAllTasks ()
 Will cancel all tasks that were spawned from this NestedProgress instance.
Public Member Functions inherited from ImFusion::Progress
Task addTask (int numSteps, const std::string &description)
 Create a new progress report for an operation with the given number of steps.
Task addBusyIndicator (const std::string &description)
 Create a busy indicator for an operation but does not have a predefined number of steps.

Public Attributes

Signal started
 these signals are executed from the worker thread, synchronization is up to the user
Signal< int, int > progress
Signal< StopReason, int > stopped
Public Attributes inherited from ImFusion::NestedProgress
ProtectedSignal< Task * > signalTaskAdded
 Signal emitted by the default implementation of NestedProgress::onTaskAdded().
ProtectedSignal< const Task * > signalTaskUpdated
 Signal emitted by the default implementation of NestedProgress::onTaskUpdated().

Protected Member Functions

void onTaskUpdated (const Task *task) override
 Function is called whenever the state of a Task has changed and the reporter should update its UI.
Protected Member Functions inherited from ImFusion::NestedProgress
void onTaskAdded (Task *task) override
 Function is called whenever a new Task has been created.
bool onTaskRequestsThreadSafety (const Task *task) override
 Function is called by Task::requestThreadSafety() in order to check whether the parent reporter supports concurrent access.
void onTaskRemoved (const Task *task) override
 Function is called whenever a Task is about to be destroyed and its pointer will become invalid.

Additional Inherited Members

Protected Attributes inherited from ImFusion::NestedProgress
Progressm_parent
const Flags< TaskModem_taskFlags
std::unique_ptr< std::mutexm_mutex
std::unique_ptr< Taskm_parentThreadSafetyGuard
std::vector< Task * > m_tasks

Member Function Documentation

◆ onTaskUpdated()

void ImFusion::WatershedComputer::onTaskUpdated ( const Task * task)
overrideprotectedvirtual

Function is called whenever the state of a Task has changed and the reporter should update its UI.

Reimplemented from ImFusion::NestedProgress.


The documentation for this class was generated from the following file:
  • ImFusion/Seg/WatershedComputer.h
Search Tab / S to search, Esc to close