20 #include <itkCommand.h>
49 m_ParameterListMutex->Lock();
51 m_ParameterListMutex->Unlock();
57 if (value && m_TriggerPropertyConnections.find(parameter) == m_TriggerPropertyConnections.end())
63 m_TriggerPropertyConnections[parameter] = value->AddObserver(itk::ModifiedEvent(), command);
69 auto iter = m_TriggerPropertyConnections.find(parameter);
71 if (iter != m_TriggerPropertyConnections.end())
75 MITK_ERROR(!value) <<
"NonBlockingAlgorithm::UnDefineTriggerProperty() in bad state." << std::endl;
78 value->RemoveObserver(m_TriggerPropertyConnections[parameter]);
79 m_TriggerPropertyConnections.erase(iter);
97 m_ParameterListMutex->Lock();
100 m_ParameterListMutex->Unlock();
101 if (m_ThreadID != -1)
107 itk::ThreadFunctionType fpointer = &StaticNonBlockingAlgorithmThread;
108 m_ThreadID = m_MultiThreader->SpawnThread(fpointer, &m_ThreadParameters);
113 if (m_ThreadID == -1)
116 m_MultiThreader->TerminateThread(m_ThreadID);
120 ITK_THREAD_RETURN_TYPE NonBlockingAlgorithm::StaticNonBlockingAlgorithmThread(
void *param)
123 itk::MultiThreader::ThreadInfoStruct *itkmttis =
static_cast<itk::MultiThreader::ThreadInfoStruct *
>(param);
126 ThreadParameters *flsp =
static_cast<ThreadParameters *
>(itkmttis->UserData);
132 return ITK_THREAD_RETURN_VALUE;
135 algorithm->m_ParameterListMutex->Lock();
136 while (algorithm->m_UpdateRequests > 0)
138 algorithm->m_UpdateRequests = 0;
139 algorithm->m_ParameterListMutex->Unlock();
142 if (algorithm->ThreadedUpdateFunction())
159 algorithm->m_ParameterListMutex->Lock();
161 algorithm->m_ParameterListMutex->Unlock();
163 return ITK_THREAD_RETURN_VALUE;
178 m_ParameterListMutex->Lock();
180 m_ParameterListMutex->Unlock();
195 m_ParameterListMutex->Lock();
197 m_ParameterListMutex->Unlock();
itk::SmartPointer< NonBlockingAlgorithm > m_Algorithm
Data management class that handles 'was created by' relations.
itk::SmartPointer< Self > Pointer
Base of all data objects.
virtual void Initialize(const NonBlockingAlgorithm *other=nullptr)
DataCollection - Class to facilitate loading/accessing structured data.
virtual void ThreadedUpdateSuccessful()
virtual bool ThreadedUpdateFunction()
DataStorage * GetDataStorage()
Abstract base class for properties.
virtual bool ReadyToRun()
mitk::DataStorage::Pointer m_DataStorage
void DefineTriggerParameter(const char *)
void CallThisFromGUIThread(itk::Command *, itk::EventObject *e=nullptr)
Change the current application cursor.
static CallbackFromGUIThread * GetInstance()
This class is a singleton.
PropertyList::Pointer m_Parameters
void UnDefineTriggerParameter(const char *)
void TriggerParameterModified(const itk::EventObject &)
virtual ~NonBlockingAlgorithm()
virtual void ThreadedUpdateFailed()
void SetPointerParameter(const char *parameter, const itk::SmartPointer< T > &value)
For any kind of smart pointers.
void StartBlockingAlgorithm()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.