MCPcopy Create free account
hub / github.com/MITK/MITK / ImagePixelReadAccessor

Class ImagePixelReadAccessor

Modules/Core/include/mitkImagePixelReadAccessor.h:35–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 */
34 template <class TPixel, unsigned int VDimension = 3>
35 class ImagePixelReadAccessor : public ImagePixelAccessor<TPixel, VDimension>
36 {
37 friend class Image;
38
39 public:
40 typedef ImagePixelAccessor<TPixel, VDimension> ImagePixelAccessorType;
41 typedef itk::SmartPointer<mitk::Image> ImagePointer;
42 typedef itk::SmartPointer<const mitk::Image> ImageConstPointer;
43
44 /** \brief Instantiates a mitk::ImageReadAccessor (see its doxygen page for more details)
45 * \param iP specifies the associated Image
46 * \param iDI specifies the allocated image part
47 * \param OptionFlags properties from mitk::ImageAccessorBase::Options can be chosen and assembled with bitwise
48 * unification.
49 * \throws mitk::Exception if the Constructor was created inappropriately
50 * \throws mitk::MemoryIsLockedException if requested image area is exclusively locked and
51 * mitk::ImageAccessorBase::ExceptionIfLocked is set in OptionFlags
52 *
53 * Includes a check if typeid of PixelType coincides with templated TPixel
54 * and a check if VDimension equals to the Dimension of the Image.
55 */
56 ImagePixelReadAccessor(ImageConstPointer iP,
57 const ImageDataItem *iDI = nullptr,
58 int OptionFlags = ImageAccessorBase::DefaultBehavior)
59 : ImagePixelAccessor<TPixel, VDimension>(iP, iDI), m_ReadAccessor(iP, iDI, OptionFlags)
60 {
61 }
62
63 /** \brief Instantiates a mitk::ImageReadAccessor from an Image smart pointer. */
64 ImagePixelReadAccessor(ImagePointer iP,
65 const ImageDataItem *iDI = nullptr,
66 int OptionFlags = ImageAccessorBase::DefaultBehavior)
67 : ImagePixelAccessor<TPixel, VDimension>(iP.GetPointer(), iDI), m_ReadAccessor(iP, iDI, OptionFlags)
68 {
69 }
70
71 /** \brief Instantiates a mitk::ImageReadAccessor from a non-const Image raw pointer. */
72 ImagePixelReadAccessor(Image *iP,
73 const ImageDataItem *iDI = nullptr,
74 int OptionFlags = ImageAccessorBase::DefaultBehavior)
75 : ImagePixelAccessor<TPixel, VDimension>(iP, iDI), m_ReadAccessor(mitk::Image::ConstPointer(iP), iDI, OptionFlags)
76 {
77 }
78
79 /** \brief Instantiates a mitk::ImageReadAccessor from a const Image raw pointer. */
80 ImagePixelReadAccessor(const Image *iP,
81 const ImageDataItem *iDI = nullptr,
82 int OptionFlags = ImageAccessorBase::DefaultBehavior)
83 : ImagePixelAccessor<TPixel, VDimension>(iP, iDI), m_ReadAccessor(iP, iDI, OptionFlags)
84 {
85 }
86
87 /** Destructor informs Image to unlock memory. */
88 ~ImagePixelReadAccessor() override {}
89 /** Returns a const reference to the pixel at given index. */
90 const TPixel &GetPixelByIndex(const itk::Index<VDimension> &idx) const
91 {
92 unsigned int offset = ImagePixelAccessorType::GetOffset(idx);

Callers

nothing calls this directly

Calls 5

GetOffsetFunction · 0.85
GetGeometryMethod · 0.80
GetTimeStepsMethod · 0.80
WorldToIndexMethod · 0.45
GetImageMethod · 0.45

Tested by

no test coverage detected