|
SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
|
#include <ImageAccessor.h>


Public Types | |
| enum | AccessHint { TOP_LEFT , CENTERED , BOTTOM_RIGHT } |
| Public Types inherited from SourceXtractor::Image< T > | |
| using | PixelType = T |
Public Member Functions | |
| ~ImageAccessor ()=default | |
| ImageAccessor (std::shared_ptr< const Image< T > > img, AccessHint hint=TOP_LEFT, int w=64, int h=1) | |
| ImageAccessor (const Image< T > &img, AccessHint hint=TOP_LEFT, int w=64, int h=64) | |
| ImageAccessor (const ImageAccessor< T > &)=delete | |
| ImageAccessor (ImageAccessor< T > &&)=default | |
| ImageAccessor< T > & | operator= (const ImageAccessor< T > &)=delete |
| T | getValue (int x, int y) |
| T | getValue (const PixelCoordinate &coord) |
| std::string | getRepr () const override |
| Get a string identifying this image in a human readable manner. | |
| int | getWidth () const override |
| Returns the width of the image in pixels. | |
| int | getHeight () const override |
| Returns the height of the image in pixels. | |
| std::shared_ptr< ImageChunk< T > > | getChunk (int x, int y, int width, int height) const override |
| Public Member Functions inherited from SourceXtractor::Image< T > | |
| virtual | ~Image ()=default |
| Destructor. | |
| std::shared_ptr< ImageChunk< T > > | getChunk (const PixelCoordinate &start, const PixelCoordinate &end) const |
| bool | isInside (int x, int y) const |
| Returns true if the given coordinates are inside the image bounds. | |
Private Member Functions | |
| void | selectChunk (const PixelCoordinate &coord) |
| void | nextCoordinates (const PixelCoordinate &coord) |
| PixelCoordinate | firstCoordinates (const PixelCoordinate &coord) |
Private Attributes | |
| const Image< T > * | m_image |
| std::shared_ptr< const Image< T > > | m_keep_alive |
| std::shared_ptr< const ImageChunk< T > > | m_chunk |
| PixelCoordinate | m_chunk_min |
| PixelCoordinate | m_chunk_max |
| AccessHint | m_hint |
| int | m_read_width |
| int | m_read_height |
The Image interface used to have a getValue(x, y) method, but this was suboptimal when using image types that need to keep state and be thread safe (i.e. BufferedImage) It was dropped, and this accessor is intended to provide an easy alternative. Unlike the images, the accessor is explicitly not thread safe and not intended to be passed around or copied. To reduce performance penalties, it can be hinted about the chunk size and the access pattern. For instance, if you know the access is away from the first coordinate in a circular fashion, the first chunk will be centered on your first read to reduce requests.
| T | Pixel type |
Definition at line 41 of file ImageAccessor.h.
| enum SourceXtractor::ImageAccessor::AccessHint |
Hints about the access pattern
Even if you don't honor the hint, it will still work!
| Enumerator | |
|---|---|
| TOP_LEFT | |
| CENTERED | |
| BOTTOM_RIGHT | |
Definition at line 48 of file ImageAccessor.h.
|
default |
Destructor
|
inlineexplicit |
Constructor
| img | Image to be accessed |
| hint | Hint about the access pattern |
| w | Width of the chunk size |
| h | Height of the chunk size |
Definition at line 72 of file ImageAccessor.h.
References m_hint, m_image, m_keep_alive, m_read_height, m_read_width, std::move(), and TOP_LEFT.
Referenced by ImageAccessor(), ImageAccessor(), and operator=().

|
inlineexplicit |
Definition at line 75 of file ImageAccessor.h.
References m_hint, m_image, m_read_height, m_read_width, and TOP_LEFT.
|
delete |
|
default |
|
inlineprivate |
Definition at line 179 of file ImageAccessor.h.
References BOTTOM_RIGHT, CENTERED, m_hint, m_read_height, m_read_width, SourceXtractor::PixelCoordinate::m_x, SourceXtractor::PixelCoordinate::m_y, and TOP_LEFT.
Referenced by nextCoordinates().
|
inlineoverridevirtual |
Implements SourceXtractor::Image< T >.
Definition at line 127 of file ImageAccessor.h.
References m_image.
|
inlineoverridevirtual |
Returns the height of the image in pixels.
Implements SourceXtractor::Image< T >.
Definition at line 123 of file ImageAccessor.h.
References m_image.
Referenced by SourceXtractor::MirrorImage< T >::getChunk(), SourceXtractor::PaddedImage< DetectionImage::PixelType >::getChunk(), SourceXtractor::PaddedImage< T, nullptr >::getChunk(), and SourceXtractor::RecenterImage< T >::getChunk().
|
inlineoverridevirtual |
Get a string identifying this image in a human readable manner.
Implements SourceXtractor::Image< T >.
Definition at line 115 of file ImageAccessor.h.
References m_image.
|
inline |
Definition at line 106 of file ImageAccessor.h.
References m_chunk, m_chunk_min, and selectChunk().

|
inline |
Drop-in replacement for Image<T>::getValue
Coordinates are always relative to the full image! As far as the caller is concerned, there is no chunk
Definition at line 99 of file ImageAccessor.h.
References m_chunk, m_chunk_min, and selectChunk().
Referenced by TestImage::addBackgroundNoise(), TestImage::addPoissonNoise(), ModelFitting::ImageTraits< WriteableInterfaceTypePtr >::at(), SourceXtractor::FlexibleModelFittingIterativeTask::computeChiSquaredForFrame(), SourceXtractor::FlexibleModelFittingTask::computeChiSquaredForFrame(), SourceXtractor::fillCutout(), SourceXtractor::MirrorImage< T >::getChunk(), SourceXtractor::PaddedImage< DetectionImage::PixelType >::getChunk(), SourceXtractor::PaddedImage< T, nullptr >::getChunk(), SourceXtractor::RecenterImage< T >::getChunk(), SourceXtractor::MoffatCheckImage::handleMessage(), SourceXtractor::MLSegmentation::labelImage(), TestImage::mainMethod(), TestImage::saturate(), SourceXtractor::ScaledImageSource< T >::ScaledImageSource(), ModelFitting::ImageTraits< WriteableInterfaceTypePtr >::shiftResizeLancszos(), SourceXtractor::FlexibleModelFittingIterativeTask::updateCheckImages(), SourceXtractor::FlexibleModelFittingTask::updateCheckImages(), and SourceXtractor::FitsWriter::writeFile().

|
inlineoverridevirtual |
Returns the width of the image in pixels.
Implements SourceXtractor::Image< T >.
Definition at line 119 of file ImageAccessor.h.
References m_image.
Referenced by SourceXtractor::MirrorImage< T >::getChunk(), SourceXtractor::PaddedImage< DetectionImage::PixelType >::getChunk(), SourceXtractor::PaddedImage< T, nullptr >::getChunk(), and SourceXtractor::RecenterImage< T >::getChunk().
|
inlineprivate |
Try to guess what's coming next. It just uses some rudimentary heuristics.
Definition at line 154 of file ImageAccessor.h.
References BOTTOM_RIGHT, CENTERED, firstCoordinates(), m_chunk, m_chunk_max, m_chunk_min, m_hint, m_image, m_read_height, m_read_width, SourceXtractor::PixelCoordinate::m_x, SourceXtractor::PixelCoordinate::m_y, and TOP_LEFT.
Referenced by selectChunk().

|
delete |
|
inlineprivate |
Verify if the requested coordinates can be satisfied, and asks for the next chunk otherwise
Definition at line 143 of file ImageAccessor.h.
References m_chunk, m_chunk_max, m_chunk_min, m_image, and nextCoordinates().
Referenced by getValue(), and getValue().

|
private |
Definition at line 134 of file ImageAccessor.h.
Referenced by getValue(), getValue(), nextCoordinates(), and selectChunk().
|
private |
Definition at line 135 of file ImageAccessor.h.
Referenced by nextCoordinates(), and selectChunk().
|
private |
Definition at line 135 of file ImageAccessor.h.
Referenced by getValue(), getValue(), nextCoordinates(), and selectChunk().
|
private |
Definition at line 136 of file ImageAccessor.h.
Referenced by firstCoordinates(), ImageAccessor(), ImageAccessor(), and nextCoordinates().
|
private |
Definition at line 132 of file ImageAccessor.h.
Referenced by getChunk(), getHeight(), getRepr(), getWidth(), ImageAccessor(), ImageAccessor(), nextCoordinates(), and selectChunk().
|
private |
Definition at line 133 of file ImageAccessor.h.
Referenced by ImageAccessor().
|
private |
Definition at line 137 of file ImageAccessor.h.
Referenced by firstCoordinates(), ImageAccessor(), ImageAccessor(), and nextCoordinates().
|
private |
Definition at line 137 of file ImageAccessor.h.
Referenced by firstCoordinates(), ImageAccessor(), ImageAccessor(), and nextCoordinates().