File failed to load: https://isis.astrogeology.usgs.gov/dev/Object/assets/jax/output/NativeMML/config.js
Isis Developer Reference
Isis::Portal Class Reference

Buffer for containing a two dimensional section of an image. More...

#include <Portal.h>

Inheritance diagram for Isis::Portal:
Inheritance graph
Collaboration diagram for Isis::Portal:
Collaboration graph

Public Member Functions

 Portal (const int bufSamps, const int bufLines, const Isis::PixelType type, const double hotSamp=-0.5, const double hotLine=-0.5)
 Constructs a Portal object.
 
 ~Portal ()
 Destroys the Portal object.
 
void SetPosition (const double sample, const double line, const int band)
 Sets the line and sample position of the buffer.
 
void SetHotSpot (const double sample=-0.5, const double line=-0.5)
 Sets the line and sample offsets for the buffer.
 
int SampleDimension () const
 Returns the number of samples in the shape buffer.
 
int LineDimension () const
 Returns the number of lines in the shape buffer.
 
int SampleDimensionScaled () const
 Returns the number of samples in the shape buffer.
 
int LineDimensionScaled () const
 Returns the number of lines in the shape buffer.
 
int BandDimension () const
 Returns the number of bands in the shape buffer.
 
double scale () const
 Returns the scale of the shape buffer.
 
int size () const
 Returns the total number of pixels in the shape buffer.
 
int Sample (const int index=0) const
 Returns the sample position associated with a shape buffer index.
 
int Line (const int index=0) const
 Returns the line position associated with a shape buffer index.
 
int Band (const int index=0) const
 Returns the band position associated with a shape buffer index.
 
void Position (const int index, int &i_samp, int &i_line, int &i_band) const
 Returns the sample, line, and band position associated with a shape buffer index.
 
int Index (const int i_samp, const int i_line, const int i_band) const
 Given a sample, line, and band position, this returns the appropriate index in the shape buffer.
 
double at (const int index) const
 Returns the value in the shape buffer at the given index.
 
double & operator[] (const int index)
 Returns the value in the shape buffer at given index.
 
const double & operator[] (const int index) const
 Returns the value in the shape buffer at given index.
 
double * DoubleBuffer () const
 Returns the value of the shape buffer.
 
void Copy (const Buffer &in, bool includeRawBuf=true)
 Allows copying of the buffer contents to another Buffer.
 
bool CopyOverlapFrom (const Buffer &in)
 Allows copying of the buffer contents of a larger buffer to another same size or smaller Buffer, using their base positions to relate data.
 
void * RawBuffer () const
 Returns a void pointer to the raw buffer.
 
Isis::PixelType PixelType () const
 Returns the raw buffer pixel type.
 
void SetBasePosition (const int start_sample, const int start_line, const int start_band)
 This method is used to set the base position of the shape buffer.
 

Protected Member Functions

void SetBaseSample (const int start_samp)
 This method is used to set the base sample position of the shape buffer.
 
void SetBaseLine (const int start_line)
 This method is used to set the base line position of the shape buffer.
 
void SetBaseBand (const int start_band)
 This method is used to set the base band position of the shape buffer.
 
void Allocate ()
 Size or resize the memory buffer.
 

Protected Attributes

int p_sample
 Starting sample to read/write.
 
int p_nsamps
 Number of samples to read/write.
 
int p_nsampsScaled
 
int p_line
 Starting line to read/write.
 
int p_nlines
 Number of lines to read/write.
 
int p_nlinesScaled
 
int p_band
 Starting band to read/write.
 
int p_nbands
 Number of bands to read/write.
 
int p_npixels
 Number of pixels (nsamps * nlines * scale ** 2) * bands.
 
double * p_buf
 Shape buffer allocated to the size of npixels for handling reads/writes.
 
const Isis::PixelType p_pixelType
 The pixel type of the raw buffer.
 
void * p_rawbuf
 The raw dm read from the disk.
 
double p_scale
 Amount to scale the buffers lines and samples, defaults to 1.
 

Detailed Description

Buffer for containing a two dimensional section of an image.

This class is a Buffer. The shape of the buffer is two dimensional in the line and sample directions only. The band dimension is always one. This class provides a random access window into a cube. The position can be set to any line, sample and band, including outside the image.

If you would like to see Portal being used in implementation, see the ProcessRubberSheet class

Author
2002-10-09 Stuart Sides

Constructor & Destructor Documentation

◆ Portal()

Isis::Portal::Portal ( const int bufSamps,
const int bufLines,
const Isis::PixelType type,
const double hotSamp = -0.5,
const double hotLine = -0.5 )
inline

Constructs a Portal object.

The hotspot defaults of (-0.5,-0.5) cause the nearest neighbor to the requested pixel to be returned in the top left corner of the portal buffer

Parameters
bufSampsThe number of samples in the portal.
bufLinesThe number of lines in the portal.
typeType of pixel in raw buffer
hotSampThe point of interest within the buffer in the sample direction. When a buffer is being setup, the hotSamp will be subtracted from the point of interest to give a buffer of the requested size around the hot spot. This number is zero based. Defaults to 0.5
hotLineThe point of interest within the buffer in the line direction. When a buffer is being setup, the hotLine will be subtracted from the point of interest to give a buffer of the requested size around the hot spot. This number is zero based. Defaults to 0.5

References Isis::Buffer::Buffer().

◆ ~Portal()

Isis::Portal::~Portal ( )
inline

Destroys the Portal object.

Member Function Documentation

◆ Allocate()

void Isis::Buffer::Allocate ( )
protectedinherited

Size or resize the memory buffer.

Exceptions
Isis::iException::System- Memory allocation failed

References _FILEINFO_, Isis::Message::MemoryAllocationFailed(), Isis::NULL8, p_buf, p_npixels, p_pixelType, p_rawbuf, Isis::SizeOf(), and Isis::IException::Unknown.

Referenced by Buffer(), Buffer(), and Isis::Brick::Resize().

◆ at()

double Isis::Buffer::at ( const int index) const
inherited

Returns the value in the shape buffer at the given index.

Parameters
indexIndex position in buffer. Out of bounds index is trapped.
Returns
double Buffer value at index
Exceptions
Isis::iException::Programmer- Array Subscript not in range

References _FILEINFO_, Isis::Message::ArraySubscriptNotInRange(), p_buf, p_npixels, and Isis::IException::Programmer.

Referenced by Isis::CubeDataThreadTester::BrickChanged(), Isis::ViewportBuffer::DataReady(), Isis::ViewportBuffer::fillBuffer(), Isis::CubeDataThreadTester::ReadBrick(), and Isis::CubeDataThreadTester::ReadWriteBrick().

◆ Band()

int Isis::Buffer::Band ( const int index = 0) const
inherited

Returns the band position associated with a shape buffer index.

The shape buffer is one dimensional. Let us assume a nsamps=2, nlines=3, and nbands=2. Therefore the total size of the shape buffer is 12 and valid index values are 0-11. Indexes 0-5 will return band 1 and 6-11 will return band 2.

Parameters
indexShape buffer index to map to a band position. Defaults to 0.
Returns
int The absolute band number based on the buffer index.

References p_band, p_nlines, and p_nsamps.

Referenced by Isis::IndependentCubeViewport::cubeDataChanged(), Isis::Average::operator()(), Isis::Equalization::ApplyFunctor::operator()(), Isis::ImageImporter::operator()(), Isis::SpectralDefinition2D::operator()(), Position(), Isis::CubeIoHandler::read(), Isis::GdalIoHandler::read(), Isis::ProcessRubberSheet::StartProcess(), and Isis::GdalIoHandler::write().

◆ BandDimension()

int Isis::Buffer::BandDimension ( ) const
inlineinherited

◆ Copy()

void Isis::Buffer::Copy ( const Buffer & in,
bool includeRawBuf = true )
inherited

Allows copying of the buffer contents to another Buffer.

Parameters
inThe Buffer to be copied.
includeRawBufWhether to include raw dm read from disk
Exceptions
Isis::iException::Programmer- Input and Output buffers are not the same size
Isis::iException::Programmer- Input and Output buffers do not use the same pixel type

References _FILEINFO_, Buffer(), p_buf, p_npixels, p_pixelType, p_rawbuf, PixelType(), Isis::IException::Programmer, size(), and Isis::SizeOf().

Referenced by Buffer(), and Isis::Cube::copy().

◆ CopyOverlapFrom()

bool Isis::Buffer::CopyOverlapFrom ( const Buffer & in)
inherited

Allows copying of the buffer contents of a larger buffer to another same size or smaller Buffer, using their base positions to relate data.

This does not copy the raw buffer.

Parameters
inThe Buffer to be copied.
Returns
The operation was successful (the buffers overlapped)

References Buffer(), Index(), Isis::NULL8, p_band, p_line, p_nbands, p_nlines, p_npixels, p_nsamps, p_sample, and size().

Referenced by Isis::GdalIoHandler::read().

◆ DoubleBuffer()

◆ Index()

int Isis::Buffer::Index ( const int i_samp,
const int i_line,
const int i_band ) const
inherited

Given a sample, line, and band position, this returns the appropriate index in the shape buffer.

Parameters
i_sampSample position.
i_lineLine position.
i_bandBand position.
Returns
int Index at the specified sample, line and band.
Exceptions
Isis::iException::Programmer- Array Subscript not in range

References _FILEINFO_, Isis::Message::ArraySubscriptNotInRange(), p_band, p_line, p_nbands, p_nlines, p_nlinesScaled, p_nsamps, p_nsampsScaled, p_sample, p_scale, and Isis::IException::Programmer.

Referenced by CopyOverlapFrom(), and Isis::ViewportBuffer::fillBuffer().

◆ Line()

int Isis::Buffer::Line ( const int index = 0) const
inherited

Returns the line position associated with a shape buffer index.

The shape buffer is one dimensional. Let us assume a nsamps=2, nlines=3, and nbands=2. Therefore the total size of the shape buffer is 12 and valid index values are 0-11. Line(0), Line(1), Line(6) and Line(7), will return a 1, Line(2), Line(3), Line(8) and Line(9) will return a 2, and Line(4), Line(5), Line(10), and Line(11) will return a 3.

Parameters
indexShape buffer index to map to a line position. Defaults to 0
Returns
int The absolute line number based on the buffer index

References p_line, p_nlines, and p_nsamps.

Referenced by Isis::CubeViewport::cubeDataChanged(), Isis::IndependentCubeViewport::cubeDataChanged(), Isis::ViewportBuffer::DataReady(), Isis::Chip::Extract(), Isis::ViewportBuffer::fillBuffer(), Isis::Average::operator()(), Isis::Equalization::CalculateFunctor::operator()(), Isis::ImageImporter::operator()(), Isis::Nearest::operator()(), Position(), Isis::CubeIoHandler::read(), Isis::GdalIoHandler::read(), Isis::GdalIoHandler::write(), Isis::QtExporter::writeGrayscale(), Isis::StreamExporter::writeGrayscale(), Isis::QtExporter::writeRgb(), Isis::StreamExporter::writeRgb(), Isis::QtExporter::writeRgba(), and Isis::StreamExporter::writeRgba().

◆ LineDimension()

◆ LineDimensionScaled()

int Isis::Buffer::LineDimensionScaled ( ) const
inlineinherited

Returns the number of lines in the shape buffer.

Returns
int

References p_nlinesScaled.

Referenced by Isis::GdalIoHandler::read().

◆ operator[]() [1/2]

double & Isis::Buffer::operator[] ( const int index)
inlineinherited

Returns the value in the shape buffer at given index.

Parameters
indexIndex position in buffer. No out of bounds index is checked
Returns
double&

References p_buf.

◆ operator[]() [2/2]

const double & Isis::Buffer::operator[] ( const int index) const
inlineinherited

Returns the value in the shape buffer at given index.

Parameters
indexIndex position in buffer. No out of bounds index is checked
Returns
double

References p_buf.

◆ PixelType()

Isis::PixelType Isis::Buffer::PixelType ( ) const
inlineinherited

Returns the raw buffer pixel type.

Returns
Isis::PixelType

References p_pixelType.

Referenced by Copy(), Isis::GdalIoHandler::read(), and Isis::GdalIoHandler::write().

◆ Position()

void Isis::Buffer::Position ( const int index,
int & i_samp,
int & i_line,
int & i_band ) const
inherited

Returns the sample, line, and band position associated with a shape buffer index.

Performs the same function as the Sample, Line, and Band methods.

Parameters
indexShape buffer index to map to a band position.
i_sampSample position in shape buffer at index.
i_lineLine position in shape buffer at index
i_bandBand position in shape buffer at index.

References Band(), Line(), and Sample().

◆ RawBuffer()

void * Isis::Buffer::RawBuffer ( ) const
inlineinherited

Returns a void pointer to the raw buffer.

Cast this void pointer using information from the PixelType() method

Returns
void* Pointer to the raw buffer

References p_rawbuf.

Referenced by Isis::GdalIoHandler::read(), and Isis::GdalIoHandler::write().

◆ Sample()

int Isis::Buffer::Sample ( const int index = 0) const
inherited

Returns the sample position associated with a shape buffer index.

The shape buffer is one dimensional. Let us assume a nsamps=2, nlines=3, and nbands=2. Therefore the total size of the shape buffer is 12 and valid index values are 0-11. Sample(0), Sample(2), Sample(4), etc will return a 1 while Sample(1), Sample(3), Sample(5), etc will return a 2.

Parameters
indexShape buffer index to map to a sample position. Defaults to 0.
Returns
int The absolute sample number based on the buffer index.

References p_nsamps, and p_sample.

Referenced by Isis::CubeViewport::cubeDataChanged(), Isis::IndependentCubeViewport::cubeDataChanged(), Isis::Chip::Extract(), Isis::ViewportBuffer::fillBuffer(), Isis::SpectralDefinition2D::operator()(), Position(), Isis::CubeIoHandler::read(), Isis::GdalIoHandler::read(), and Isis::GdalIoHandler::write().

◆ SampleDimension()

◆ SampleDimensionScaled()

int Isis::Buffer::SampleDimensionScaled ( ) const
inlineinherited

Returns the number of samples in the shape buffer.

Returns
int

References p_nsampsScaled.

Referenced by Isis::GdalIoHandler::read().

◆ scale()

double Isis::Buffer::scale ( ) const
inlineinherited

Returns the scale of the shape buffer.

Returns
double

References p_scale.

Referenced by Isis::Brick::Brick(), Isis::Brick::Brick(), Isis::Brick::Brick(), Buffer(), Isis::BufferManager::BufferManager(), and Isis::GdalIoHandler::read().

◆ SetBaseBand()

void Isis::Buffer::SetBaseBand ( const int start_band)
inlineprotectedinherited

This method is used to set the base band position of the shape buffer.

Parameters
start_bandStarting band to set

References p_band.

Referenced by Isis::Brick::SetBaseBand(), and SetBasePosition().

◆ SetBaseLine()

void Isis::Buffer::SetBaseLine ( const int start_line)
inlineprotectedinherited

This method is used to set the base line position of the shape buffer.

Parameters
start_lineStarting line to set

References p_line.

Referenced by Isis::Brick::SetBaseLine(), and SetBasePosition().

◆ SetBasePosition()

void Isis::Buffer::SetBasePosition ( const int start_sample,
const int start_line,
const int start_band )
inherited

This method is used to set the base position of the shape buffer.

In general it is used by BufferManager objects to progress sequentially through a cube by line, tile, boxcar, etc.

Parameters
start_sampleStarting sample to set.
start_lineStarting line to set.
start_bandStarting band to set.

References SetBaseBand(), SetBaseLine(), and SetBaseSample().

Referenced by Isis::Brick::SetBasePosition(), Isis::BufferManager::setpos(), and Isis::Portal::SetPosition().

◆ SetBaseSample()

void Isis::Buffer::SetBaseSample ( const int start_samp)
inlineprotectedinherited

This method is used to set the base sample position of the shape buffer.

Parameters
start_sampStarting sample to set

References p_sample.

Referenced by SetBasePosition(), and Isis::Brick::SetBaseSample().

◆ SetHotSpot()

void Isis::Portal::SetHotSpot ( const double sample = -0.5,
const double line = -0.5 )
inline

Sets the line and sample offsets for the buffer.

The defaults of (-0.5,-0.5) cause the nearest neighbor to the requested pixel to be returned in the top left corner of the portal buffer

Parameters
sampleThe sample offset for the buffer. A zero for this parameter will cause the buffer to be alligned with the hot spot at the left edge of the buffer. Defaults to 0.5
lineThe line offset for the buffer. A zero for this parameter will cause the buffer to be alligned with the hot spot at the top edge of the buffer. Defaults to 0.5

◆ SetPosition()

void Isis::Portal::SetPosition ( const double sample,
const double line,
const int band )
inline

Sets the line and sample position of the buffer.

The hotspot location is subtracted from this position to set the upper left corner of the buffer.

Parameters
sampleThe sample position of the buffer.
lineThe line position of the buffer.
bandThe band position of the buffer.

References Isis::Buffer::SetBasePosition().

Referenced by Isis::Chip::Extract(), Isis::InterestOperator::InterestByMeasure(), Isis::ProcessRubberSheet::processPatchTransform(), and Isis::ControlNetValidMeasure::ValidStandardOptions().

◆ size()

Member Data Documentation

◆ p_band

int Isis::Buffer::p_band
protectedinherited

Starting band to read/write.

Referenced by Band(), Buffer(), Buffer(), Buffer(), CopyOverlapFrom(), Index(), and SetBaseBand().

◆ p_buf

double* Isis::Buffer::p_buf
protectedinherited

Shape buffer allocated to the size of npixels for handling reads/writes.

Referenced by Allocate(), at(), Buffer(), Copy(), DoubleBuffer(), operator=(), operator[](), operator[](), Isis::Brick::Resize(), and ~Buffer().

◆ p_line

int Isis::Buffer::p_line
protectedinherited

Starting line to read/write.

Referenced by Buffer(), Buffer(), Buffer(), CopyOverlapFrom(), Index(), Line(), and SetBaseLine().

◆ p_nbands

int Isis::Buffer::p_nbands
protectedinherited

Number of bands to read/write.

Referenced by BandDimension(), Buffer(), Buffer(), Buffer(), CopyOverlapFrom(), Index(), and Isis::Brick::Resize().

◆ p_nlines

int Isis::Buffer::p_nlines
protectedinherited

Number of lines to read/write.

Referenced by Band(), Buffer(), Buffer(), Buffer(), CopyOverlapFrom(), Index(), Line(), LineDimension(), and Isis::Brick::Resize().

◆ p_nlinesScaled

int Isis::Buffer::p_nlinesScaled
protectedinherited

◆ p_npixels

int Isis::Buffer::p_npixels
protectedinherited

Number of pixels (nsamps * nlines * scale ** 2) * bands.

Referenced by Allocate(), at(), Buffer(), Buffer(), Buffer(), Copy(), CopyOverlapFrom(), operator=(), Isis::Brick::Resize(), and size().

◆ p_nsamps

int Isis::Buffer::p_nsamps
protectedinherited

Number of samples to read/write.

Referenced by Band(), Buffer(), Buffer(), Buffer(), CopyOverlapFrom(), Index(), Line(), Isis::Brick::Resize(), Sample(), and SampleDimension().

◆ p_nsampsScaled

int Isis::Buffer::p_nsampsScaled
protectedinherited

◆ p_pixelType

const Isis::PixelType Isis::Buffer::p_pixelType
protectedinherited

The pixel type of the raw buffer.

Referenced by Allocate(), Buffer(), Buffer(), Buffer(), Copy(), and PixelType().

◆ p_rawbuf

void* Isis::Buffer::p_rawbuf
protectedinherited

The raw dm read from the disk.

Referenced by Allocate(), Buffer(), Copy(), RawBuffer(), Isis::Brick::Resize(), and ~Buffer().

◆ p_sample

int Isis::Buffer::p_sample
protectedinherited

Starting sample to read/write.

Referenced by Buffer(), Buffer(), Buffer(), CopyOverlapFrom(), Index(), Sample(), and SetBaseSample().

◆ p_scale

double Isis::Buffer::p_scale
protectedinherited

Amount to scale the buffers lines and samples, defaults to 1.

Referenced by Buffer(), Buffer(), Buffer(), Index(), Isis::Brick::Resize(), and scale().


The documentation for this class was generated from the following file: