USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::Portal Class Reference
[Low Level Cube I/O]

#include <Portal.h>

Inheritance diagram for Isis::Portal:

Inheritance graph
[legend]
Collaboration diagram for Isis::Portal:

Collaboration graph
[legend]
List of all members.

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

For internal use only.

History:
2003-05-16 Stuart Sides - Modified schema from astrogeology... isis.astrogeology...
History:
2005-02-28 Elizabeth Ribelin - Modified file to support Doxygen documentation

Definition at line 52 of file Portal.h.

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 BandDimension () const
 Returns the number of bands in 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 throw (Isis::iException &)
 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.
double * DoubleBuffer () const
 Returns the value of the shape buffer.
void Copy (const Buffer &in)
 Allows copying of the buffer contents to another Buffer.
void * RawBuffer () const
 Returns a void pointer to the raw buffer.
Isis::PixelType PixelType () const
 Returns the raw buffer pixel type.

Protected Member Functions

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.
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_line
 Starting line to read/write.
int p_nlines
 Number of lines to read/write.
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 * nbands).
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.

Private Attributes

double p_hotSample
 The sample position within the buffer which is the point of interest.
double p_hotLine
 The line position within the buffer which is the point of interest.


Constructor & Destructor Documentation

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:
bufSamps The number of samples in the portal.
bufLines The number of lines in the portal.
type Type of pixel in raw buffer
hotSamp The 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
hotLine The 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

Definition at line 88 of file Portal.h.

References p_hotLine, and p_hotSample.

Isis::Portal::~Portal (  )  [inline]

Destroys the Portal object.

Definition at line 96 of file Portal.h.


Member Function Documentation

void Isis::Buffer::Allocate (  )  [protected, inherited]

Size or resize the memory buffer.

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

Definition at line 295 of file Buffer.cpp.

References _FILEINFO_, Isis::Message::MemoryAllocationFailed(), Isis::iException::Message(), Isis::Buffer::p_buf, Isis::Buffer::p_npixels, Isis::Buffer::p_pixelType, Isis::Buffer::p_rawbuf, and Isis::SizeOf().

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

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

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

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

Definition at line 234 of file Buffer.cpp.

References _FILEINFO_, Isis::Message::ArraySubscriptNotInRange(), Isis::iException::Message(), Isis::Buffer::p_buf, and Isis::Buffer::p_npixels.

Referenced by Qisis::StatisticsTool::getStatistics().

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:
index Shape buffer index to map to a band position. Defaults to 0.
Returns:
int The absolute band number based on the buffer index.

Definition at line 167 of file Buffer.cpp.

References Isis::Buffer::p_band, Isis::Buffer::p_nlines, and Isis::Buffer::p_nsamps.

Referenced by Isis::Buffer::Position(), Isis::ProcessRubberSheet::QuadTree(), Isis::CubeTileHandler::Read(), Isis::CubeBsqHandler::Read(), Isis::ProcessRubberSheet::SlowGeom(), Isis::ProcessRubberSheet::StartProcess(), Isis::CubeTileHandler::Write(), and Isis::CubeBsqHandler::Write().

int Isis::Buffer::BandDimension (  )  const [inline, inherited]

Returns the number of bands in the shape buffer.

Returns:
int

Definition at line 97 of file Buffer.h.

References Isis::Buffer::p_nbands.

void Isis::Buffer::Copy ( const Buffer in  )  [inherited]

Allows copying of the buffer contents to another Buffer.

Parameters:
in The Buffer to be copied.
Exceptions:
Isis::iException::Programmer - Input and Output buffers are not the same size

Definition at line 255 of file Buffer.cpp.

References _FILEINFO_, in, Isis::iException::Message(), Isis::Buffer::p_buf, Isis::Buffer::p_npixels, Isis::Buffer::p_pixelType, Isis::Buffer::p_rawbuf, Isis::Buffer::size(), and Isis::SizeOf().

Referenced by Isis::Buffer::Buffer(), and Qisis::FileTool::copy().

double* Isis::Buffer::DoubleBuffer (  )  const [inline, inherited]

Returns the value of the shape buffer.

Returns:
double* The shape buffer

Definition at line 131 of file Buffer.h.

References Isis::Buffer::p_buf.

Referenced by Qisis::HistogramTool::changePlot(), Isis::Sensor::DemRadius(), Qisis::PlotTool::getSpectralStatistics(), Isis::ProcessRubberSheet::QuadTree(), Isis::ProcessRubberSheet::SlowGeom(), Isis::ProcessByQuickFilter::StartProcess(), Isis::CubeIoHandler::ToDouble(), and Isis::CubeIoHandler::ToRaw().

int Isis::Buffer::Index ( const int  i_samp,
const int  i_line,
const int  i_band 
) const throw (Isis::iException &) [inherited]

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

Parameters:
i_samp Sample position.
i_line Line position.
i_band Band position.
Returns:
int Index at the specified sample, line and band.
Exceptions:
Isis::iException::Programmer - Array Subscript not in range

Definition at line 200 of file Buffer.cpp.

References _FILEINFO_, Isis::Message::ArraySubscriptNotInRange(), and Isis::iException::Message().

Referenced by Isis::CubeTileHandler::Read(), Isis::CubeBsqHandler::Read(), Isis::CubeTileHandler::Write(), and Isis::CubeBsqHandler::Write().

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:
index Shape buffer index to map to a line position. Defaults to 0
Returns:
int The absolute line number based on the buffer index

Definition at line 151 of file Buffer.cpp.

References Isis::Buffer::p_line, Isis::Buffer::p_nlines, and Isis::Buffer::p_nsamps.

Referenced by Isis::Buffer::Position(), Isis::ProcessRubberSheet::QuadTree(), Isis::CubeTileHandler::Read(), Isis::CubeBsqHandler::Read(), Qisis::EditTool::redoEdit(), Isis::ProcessRubberSheet::SlowGeom(), Qisis::EditTool::undoEdit(), Isis::CubeTileHandler::Write(), Isis::CubeBsqHandler::Write(), and Qisis::EditTool::writeToCube().

int Isis::Buffer::LineDimension (  )  const [inline, inherited]

Returns the number of lines in the shape buffer.

Returns:
int

Definition at line 90 of file Buffer.h.

References Isis::Buffer::p_nlines.

Referenced by Qisis::EditTool::redoEdit(), Qisis::EditTool::undoEdit(), and Qisis::EditTool::writeToCube().

double& Isis::Buffer::operator[] ( const int  index  )  [inline, inherited]

Returns the value in the shape buffer at given index.

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

Definition at line 124 of file Buffer.h.

References Isis::Buffer::p_buf.

Isis::PixelType Isis::Buffer::PixelType (  )  const [inline, inherited]

Returns the raw buffer pixel type.

Returns:
Isis::PixelType

Definition at line 147 of file Buffer.h.

References Isis::Buffer::p_pixelType.

Referenced by Isis::CubeIoHandler::ToDouble(), and Isis::CubeIoHandler::ToRaw().

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:
index Shape buffer index to map to a band position.
i_samp Sample position in shape buffer at index.
i_line Line position in shape buffer at index
i_band Band position in shape buffer at index.

Definition at line 181 of file Buffer.cpp.

References Isis::Buffer::Band(), Isis::Buffer::Line(), and Isis::Buffer::Sample().

void* Isis::Buffer::RawBuffer (  )  const [inline, inherited]

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

Definition at line 140 of file Buffer.h.

References Isis::Buffer::p_rawbuf.

Referenced by Isis::CubeTileHandler::Read(), Isis::CubeBsqHandler::Read(), Isis::CubeIoHandler::ToDouble(), Isis::CubeIoHandler::ToRaw(), Isis::CubeTileHandler::Write(), and Isis::CubeBsqHandler::Write().

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:
index Shape buffer index to map to a sample position. Defaults to 0.
Returns:
int The absolute sample number based on the buffer index.

Definition at line 134 of file Buffer.cpp.

References Isis::Buffer::p_nsamps, and Isis::Buffer::p_sample.

Referenced by Qisis::ViewportBuffer::fillBuffer(), Isis::Buffer::Position(), Isis::ProcessRubberSheet::QuadTree(), Isis::CubeTileHandler::Read(), Isis::CubeBsqHandler::Read(), Qisis::EditTool::redoEdit(), Isis::ProcessRubberSheet::SlowGeom(), Qisis::EditTool::undoEdit(), Isis::CubeTileHandler::Write(), Isis::CubeBsqHandler::Write(), and Qisis::EditTool::writeToCube().

int Isis::Buffer::SampleDimension (  )  const [inline, inherited]

Returns the number of samples in the shape buffer.

Returns:
int

Definition at line 83 of file Buffer.h.

References Isis::Buffer::p_nsamps.

Referenced by Isis::CubeTileHandler::Read(), Isis::CubeBsqHandler::Read(), Qisis::EditTool::redoEdit(), Qisis::EditTool::undoEdit(), Isis::CubeTileHandler::Write(), Isis::CubeBsqHandler::Write(), and Qisis::EditTool::writeToCube().

void Isis::Buffer::SetBaseBand ( const int  start_band  )  [inline, protected, inherited]

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

Parameters:
start_band Starting band to set

Reimplemented in Isis::Brick.

Definition at line 174 of file Buffer.h.

References Isis::Buffer::p_band.

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

void Isis::Buffer::SetBaseLine ( const int  start_line  )  [inline, protected, inherited]

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

Parameters:
start_line Starting line to set

Reimplemented in Isis::Brick.

Definition at line 166 of file Buffer.h.

References Isis::Buffer::p_line.

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

void Isis::Buffer::SetBasePosition ( const int  start_sample,
const int  start_line,
const int  start_band 
) [protected, 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_sample Starting sample to set.
start_line Starting line to set.
start_band Starting band to set.

Reimplemented in Isis::Brick.

Definition at line 114 of file Buffer.cpp.

References Isis::Buffer::SetBaseBand(), Isis::Buffer::SetBaseLine(), and Isis::Buffer::SetBaseSample().

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

void Isis::Buffer::SetBaseSample ( const int  start_samp  )  [inline, protected, inherited]

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

Parameters:
start_samp Starting sample to set

Reimplemented in Isis::Brick.

Definition at line 158 of file Buffer.h.

References Isis::Buffer::p_sample.

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

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:
sample The 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
line The 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

Definition at line 128 of file Portal.h.

References line, p_hotLine, p_hotSample, and sample.

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:
sample The sample position of the buffer.
line The line position of the buffer.
band The band position of the buffer.

Definition at line 109 of file Portal.h.

References p_hotLine, p_hotSample, and Isis::Buffer::SetBasePosition().

Referenced by Isis::Sensor::DemRadius(), Isis::ProcessRubberSheet::QuadTree(), Isis::ProcessRubberSheet::SlowGeom(), and Isis::ProcessMosaic::StartProcess().

int Isis::Buffer::size (  )  const [inline, inherited]

Returns the total number of pixels in the shape buffer.

Returns:
int

Definition at line 104 of file Buffer.h.

References Isis::Buffer::p_npixels.

Referenced by Isis::Buffer::Copy(), Qisis::ViewportBuffer::fillBuffer(), Isis::ProcessMapMosaic::FillNull(), Isis::ProcessExport::isisOut16s(), Isis::ProcessExport::isisOut16u(), Isis::ProcessExport::isisOut32(), Isis::ProcessExport::isisOut8(), Isis::Calculator::Push(), Isis::ProcessRubberSheet::QuadTree(), Isis::CubeTileHandler::Read(), Isis::CubeBsqHandler::Read(), Isis::ProcessRubberSheet::SlowGeom(), Isis::ProcessMosaic::StartProcess(), Isis::ProcessExport::StartProcess(), Isis::CubeIoHandler::ToDouble(), Isis::CubeIoHandler::ToRaw(), Isis::CubeTileHandler::Write(), Isis::CubeBsqHandler::Write(), and Qisis::EditTool::writeToCube().


Member Data Documentation

int Isis::Buffer::p_band [protected, inherited]

Starting band to read/write.

Definition at line 183 of file Buffer.h.

Referenced by Isis::Buffer::Band(), Isis::Buffer::Buffer(), and Isis::Buffer::SetBaseBand().

double* Isis::Buffer::p_buf [protected, inherited]

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

Definition at line 187 of file Buffer.h.

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

double Isis::Portal::p_hotLine [private]

The line position within the buffer which is the point of interest.

This position is zero based and has no default.

Definition at line 58 of file Portal.h.

Referenced by Portal(), SetHotSpot(), and SetPosition().

double Isis::Portal::p_hotSample [private]

The sample position within the buffer which is the point of interest.

This position is zero based and has no default.

Definition at line 55 of file Portal.h.

Referenced by Portal(), SetHotSpot(), and SetPosition().

int Isis::Buffer::p_line [protected, inherited]

Starting line to read/write.

Definition at line 180 of file Buffer.h.

Referenced by Isis::Buffer::Buffer(), Isis::Buffer::Line(), and Isis::Buffer::SetBaseLine().

int Isis::Buffer::p_nbands [protected, inherited]

Number of bands to read/write.

Definition at line 184 of file Buffer.h.

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

int Isis::Buffer::p_nlines [protected, inherited]

Number of lines to read/write.

Definition at line 181 of file Buffer.h.

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

int Isis::Buffer::p_npixels [protected, inherited]

Number of pixels (nsamps * nlines * nbands).

Definition at line 186 of file Buffer.h.

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

int Isis::Buffer::p_nsamps [protected, inherited]

Number of samples to read/write.

Definition at line 178 of file Buffer.h.

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

const Isis::PixelType Isis::Buffer::p_pixelType [protected, inherited]

The pixel type of the raw buffer.

Definition at line 190 of file Buffer.h.

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

void* Isis::Buffer::p_rawbuf [protected, inherited]

The raw dm read from the disk.

Definition at line 191 of file Buffer.h.

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

int Isis::Buffer::p_sample [protected, inherited]

Starting sample to read/write.

Definition at line 177 of file Buffer.h.

Referenced by Isis::Buffer::Buffer(), Isis::Buffer::Sample(), and Isis::Buffer::SetBaseSample().


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