35 :
ImageAccessorBase(image.GetPointer(), iDI, OptionFlags), m_Image(image.GetPointer())
63 m_Image->m_ReadWriteLock.Lock();
66 auto it = std::find(m_Image->m_Readers.begin(), m_Image->m_Readers.end(),
this);
67 m_Image->m_Readers.erase(it);
80 m_Image->m_ReadWriteLock.Unlock();
90 return m_Image.GetPointer();
93 void mitk::ImageReadAccessor::OrganizeReadAccess()
95 m_Image->m_ReadWriteLock.Lock();
98 if (m_Image->m_Writers.size() > 0)
102 auto it = m_Image->m_Writers.begin();
104 for (; it != m_Image->m_Writers.end(); ++it)
118 m_Image->m_ReadWriteLock.Unlock();
122 OrganizeReadAccess();
128 m_Image->m_ReadWriteLock.Unlock();
130 <<
"The image part being ordered by the ImageAccessor is already in use and locked";
142 m_Image->m_Readers.push_back(
this);
146 m_Image->m_ReadWriteLock.Unlock();
const Image * GetImage() const override
~ImageReadAccessor() override
void WaitForReleaseOf(ImageAccessorWaitLock *wL)
Uses the WaitLock to wait for another ImageAccessor.
unsigned int m_WaiterCount
Holds the number of ImageAccessors, which are waiting until the represented ImageAccessor is released...
bool Overlap(const ImageAccessorBase *iAB)
Computes if there is an Overlap of the image part between this instantiation and another ImageAccesso...
ImageAccessorWaitLock * m_WaitLock
Pointer to a WaitLock struct, that allows other ImageAccessors to wait for this ImageAccessor.
Image class for storing images.
mitk::Image::Pointer image
ImageReadAccessor(ImageConstPointer image, const ImageDataItem *iDI=nullptr, int OptionFlags=ImageAccessorBase::DefaultBehavior)
Orders read access for a slice, volume or 4D-Image.
void PreventRecursiveMutexLock(ImageAccessorBase *iAB)
Prevents a recursive mutex lock by comparing thread ids of competing image accessors.
void Increment()
Increments m_WaiterCount. A call of this method is prohibited unless the Mutex m_ReadWriteLock in the...
#define mitkThrowException(classname)
int m_Options
Stores all extended properties of an ImageAccessor. The different flags in mitk::ImageAccessorBase::O...
itk::SimpleFastMutexLock m_Mutex
A mutex that allows other ImageAccessors to wait for the represented ImageAccessor.
Internal class for managing references on sub-images.