Skip to content

Commit

Permalink
ENH: Add AllocateInitialized() to ImageBase
Browse files Browse the repository at this point in the history
Equivalent to `Allocate(true)`. Aims to help improve readability of user code.
  • Loading branch information
N-Dekker committed Feb 26, 2024
1 parent adcc46b commit 47fe345
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Modules/Core/Common/include/itkImageBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ class ITK_TEMPLATE_EXPORT ImageBase : public DataObject
virtual void
Allocate(bool initialize = false);

/** Allocates the pixel buffer of the image, zero-initializing its pixels. `AllocateInitialized()` is equivalent to
* `Allocate(true)`. It is just intended to make the code more readable. */
void
AllocateInitialized()
{
return this->Allocate(true);
}

/** Set the region object that defines the size and starting index
* for the largest possible region this image could represent. This
* is used in determining how much memory would be needed to load an
Expand Down

0 comments on commit 47fe345

Please sign in to comment.