Isis 3 Programmer Reference
|
Buffer for containing a two dimensional section of an image. More...
#include <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. More... | |
~Portal () | |
Destroys the Portal object. More... | |
void | SetPosition (const double sample, const double line, const int band) |
Sets the line and sample position of the buffer. More... | |
void | SetHotSpot (const double sample=-0.5, const double line=-0.5) |
Sets the line and sample offsets for the buffer. More... | |
int | SampleDimension () const |
Returns the number of samples in the shape buffer. More... | |
int | LineDimension () const |
Returns the number of lines in the shape buffer. More... | |
int | BandDimension () const |
Returns the number of bands in the shape buffer. More... | |
int | size () const |
Returns the total number of pixels in the shape buffer. More... | |
int | Sample (const int index=0) const |
Returns the sample position associated with a shape buffer index. More... | |
int | Line (const int index=0) const |
Returns the line position associated with a shape buffer index. More... | |
int | Band (const int index=0) const |
Returns the band position associated with a shape buffer index. More... | |
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. More... | |
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. More... | |
double | at (const int index) const |
Returns the value in the shape buffer at the given index. More... | |
double & | operator[] (const int index) |
Returns the value in the shape buffer at given index. More... | |
const double & | operator[] (const int index) const |
Returns the value in the shape buffer at given index. More... | |
double * | DoubleBuffer () const |
Returns the value of the shape buffer. More... | |
void | Copy (const Buffer &in, bool includeRawBuf=true) |
Allows copying of the buffer contents to another Buffer. More... | |
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. More... | |
void * | RawBuffer () const |
Returns a void pointer to the raw buffer. More... | |
Isis::PixelType | PixelType () const |
Returns the raw buffer pixel type. More... | |
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. More... | |
void | SetBaseSample (const int start_samp) |
This method is used to set the base sample position of the shape buffer. More... | |
void | SetBaseLine (const int start_line) |
This method is used to set the base line position of the shape buffer. More... | |
void | SetBaseBand (const int start_band) |
This method is used to set the base band position of the shape buffer. More... | |
void | Allocate () |
Size or resize the memory buffer. More... | |
Protected Attributes | |
int | p_sample |
Starting sample to read/write. More... | |
int | p_nsamps |
Number of samples to read/write. More... | |
int | p_line |
Starting line to read/write. More... | |
int | p_nlines |
Number of lines to read/write. More... | |
int | p_band |
Starting band to read/write. More... | |
int | p_nbands |
Number of bands to read/write. More... | |
int | p_npixels |
Number of pixels (nsamps * nlines * nbands) More... | |
double * | p_buf |
Shape buffer allocated to the size of npixels for handling reads/writes. More... | |
const Isis::PixelType | p_pixelType |
The pixel type of the raw buffer. More... | |
void * | p_rawbuf |
The raw dm read from the disk. More... | |
Private Attributes | |
double | p_hotSample |
The sample position within the buffer which is the point of interest. More... | |
double | p_hotLine |
The line position within the buffer which is the point of interest. More... | |
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
2003-05-16 Stuart Sides - Modified schema from astrogeology... isis.astrogeology...
2005-02-28 Elizabeth Ribelin - Modified file to support Doxygen documentation
|
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
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.
|
inline |
|
protectedinherited |
Size or resize the memory buffer.
Isis::iException::System | - Memory allocation failed |
Definition at line 356 of file Buffer.cpp.
References _FILEINFO_, Isis::Message::MemoryAllocationFailed(), Isis::Buffer::p_buf, Isis::Buffer::p_npixels, Isis::Buffer::p_pixelType, Isis::Buffer::p_rawbuf, Isis::SizeOf(), and Isis::IException::Unknown.
Referenced by Isis::Buffer::Buffer(), and Isis::Brick::Resize().
|
inherited |
Returns the value in the shape buffer at the given index.
index | Index position in buffer. Out of bounds index is trapped. |
Isis::iException::Programmer | - Array Subscript not in range |
Definition at line 247 of file Buffer.cpp.
References _FILEINFO_, Isis::Message::ArraySubscriptNotInRange(), Isis::Buffer::p_buf, Isis::Buffer::p_npixels, and Isis::IException::Programmer.
Referenced by Isis::CubeDataThreadTester::BrickChanged(), Isis::ViewportBuffer::DataReady(), Isis::ViewportBuffer::fillBuffer(), Isis::StatisticsTool::getStatistics(), Isis::CubeDataThreadTester::ReadBrick(), and Isis::CubeDataThreadTester::ReadWriteBrick().
|
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.
index | Shape buffer index to map to a band position. Defaults to 0. |
Definition at line 178 of file Buffer.cpp.
References Isis::Buffer::p_band, Isis::Buffer::p_nlines, and Isis::Buffer::p_nsamps.
Referenced by Isis::CubeIoHandler::bufferLessThan(), Isis::Buffer::CopyOverlapFrom(), Isis::CubeIoHandler::findIntersection(), Isis::ImageImporter::operator()(), Isis::SpectralDefinition2D::operator()(), Isis::Average::operator()(), Isis::ProcessByBrick::ProcessCubesFunctor< T >::operator()(), Isis::CubeDataThread::OverlapIndex(), Isis::Buffer::Position(), Isis::CubeIoHandler::read(), Isis::ProcessRubberSheet::StartProcess(), Isis::CubeIoHandler::synchronousWrite(), Isis::CubeIoHandler::writeIntoDouble(), and Isis::CubeIoHandler::writeIntoRaw().
|
inlineinherited |
Returns the number of bands in the shape buffer.
Definition at line 104 of file Buffer.h.
References Isis::Buffer::p_nbands.
Referenced by Isis::CubeIoHandler::bufferLessThan(), Isis::CubeIoHandler::findIntersection(), Isis::CubeIoHandler::read(), Isis::RegionalCachingAlgorithm::recommendChunksToFree(), Isis::Hillshade::shadedValue(), Isis::CubeIoHandler::synchronousWrite(), Isis::CubeIoHandler::writeIntoDouble(), and Isis::CubeIoHandler::writeIntoRaw().
|
inherited |
Allows copying of the buffer contents to another Buffer.
in | The Buffer to be copied. |
includeRawBuf | Whether to include raw dm read from disk |
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 |
Definition at line 271 of file Buffer.cpp.
References _FILEINFO_, Isis::Buffer::p_buf, Isis::Buffer::p_npixels, Isis::Buffer::p_pixelType, Isis::Buffer::p_rawbuf, Isis::Buffer::PixelType(), Isis::IException::Programmer, Isis::Buffer::size(), and Isis::SizeOf().
Referenced by Isis::Buffer::Buffer(), and Isis::FileTool::copy().
|
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.
in | The Buffer to be copied. |
Definition at line 301 of file Buffer.cpp.
References Isis::Buffer::Band(), Isis::Buffer::Index(), Isis::Buffer::Line(), Isis::Buffer::p_band, Isis::Buffer::p_line, Isis::Buffer::p_nbands, Isis::Buffer::p_nlines, Isis::Buffer::p_npixels, Isis::Buffer::p_nsamps, Isis::Buffer::p_sample, Isis::Buffer::Sample(), and Isis::Buffer::size().
|
inlineinherited |
Returns the value of the shape buffer.
Definition at line 154 of file Buffer.h.
References Isis::Buffer::p_buf.
Referenced by Isis::Process::CalculateStatistics(), Isis::ControlPointEditWidget::demRadius(), Isis::QnetTool::demRadius(), Isis::SpectralPlotTool::getSpectralStatistics(), Isis::Cube::histogram(), Isis::DemShape::localRadius(), Isis::HistogramTool::refreshPlot(), Isis::ProcessByQuickFilter::StartProcess(), Isis::Cube::statistics(), Isis::CubeIoHandler::writeIntoDouble(), and Isis::CubeIoHandler::writeIntoRaw().
|
inherited |
Given a sample, line, and band position, this returns the appropriate index in the shape buffer.
i_samp | Sample position. |
i_line | Line position. |
i_band | Band position. |
Isis::iException::Programmer | - Array Subscript not in range |
Definition at line 213 of file Buffer.cpp.
References _FILEINFO_, Isis::Message::ArraySubscriptNotInRange(), Isis::Buffer::p_band, Isis::Buffer::p_line, Isis::Buffer::p_nbands, Isis::Buffer::p_nlines, Isis::Buffer::p_nsamps, Isis::Buffer::p_sample, and Isis::IException::Programmer.
Referenced by Isis::Buffer::CopyOverlapFrom(), Isis::ViewportBuffer::fillBuffer(), Isis::CubeIoHandler::writeIntoDouble(), and Isis::CubeIoHandler::writeIntoRaw().
|
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.
index | Shape buffer index to map to a line position. Defaults to 0 |
Definition at line 161 of file Buffer.cpp.
References Isis::Buffer::p_line, Isis::Buffer::p_nlines, and Isis::Buffer::p_nsamps.
Referenced by Isis::CubeIoHandler::bufferLessThan(), Isis::Buffer::CopyOverlapFrom(), Isis::CubeViewport::cubeDataChanged(), Isis::ViewportBuffer::DataReady(), Isis::ViewportBuffer::fillBuffer(), Isis::CubeIoHandler::findIntersection(), Isis::ImageImporter::operator()(), Isis::Nearest::operator()(), Isis::Average::operator()(), Isis::CubeDataThread::OverlapIndex(), Isis::Buffer::Position(), Isis::CubeIoHandler::read(), Isis::EditTool::redoEdit(), Isis::CubeIoHandler::synchronousWrite(), Isis::EditTool::undoEdit(), Isis::StreamExporter::writeGrayscale(), Isis::QtExporter::writeGrayscale(), Isis::StreamExporter::writeRgb(), Isis::QtExporter::writeRgb(), Isis::StreamExporter::writeRgba(), Isis::QtExporter::writeRgba(), and Isis::EditTool::writeToCube().
|
inlineinherited |
Returns the number of lines in the shape buffer.
Definition at line 95 of file Buffer.h.
References Isis::Buffer::p_nlines.
Referenced by Isis::CubeIoHandler::bufferLessThan(), Isis::CubeViewport::cubeDataChanged(), Isis::ViewportBuffer::fillBuffer(), Isis::CubeIoHandler::findIntersection(), Isis::CubeIoHandler::read(), Isis::RegionalCachingAlgorithm::recommendChunksToFree(), Isis::EditTool::redoEdit(), Isis::Hillshade::shadedValue(), Isis::CubeIoHandler::synchronousWrite(), Isis::EditTool::undoEdit(), and Isis::EditTool::writeToCube().
|
inlineinherited |
Returns the value in the shape buffer at given index.
index | Index position in buffer. No out of bounds index is checked |
Definition at line 134 of file Buffer.h.
References Isis::Buffer::p_buf.
|
inlineinherited |
Returns the value in the shape buffer at given index.
index | Index position in buffer. No out of bounds index is checked |
Definition at line 145 of file Buffer.h.
References Isis::Buffer::p_buf.
|
inlineinherited |
Returns the raw buffer pixel type.
Definition at line 176 of file Buffer.h.
References Isis::Buffer::p_pixelType.
Referenced by Isis::Buffer::Copy().
|
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.
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 193 of file Buffer.cpp.
References Isis::Buffer::Band(), Isis::Buffer::Line(), and Isis::Buffer::Sample().
|
inlineinherited |
Returns a void pointer to the raw buffer.
Cast this void pointer using information from the PixelType() method
Definition at line 167 of file Buffer.h.
References Isis::Buffer::p_rawbuf.
Referenced by Isis::CubeIoHandler::writeIntoDouble().
|
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.
index | Shape buffer index to map to a sample position. Defaults to 0. |
Definition at line 143 of file Buffer.cpp.
References Isis::Buffer::p_nsamps, and Isis::Buffer::p_sample.
Referenced by Isis::CubeIoHandler::bufferLessThan(), Isis::Buffer::CopyOverlapFrom(), Isis::CubeViewport::cubeDataChanged(), Isis::ViewportBuffer::DataReady(), Isis::ViewportBuffer::fillBuffer(), Isis::CubeIoHandler::findIntersection(), Isis::SpectralDefinition2D::operator()(), Isis::CubeDataThread::OverlapIndex(), Isis::Buffer::Position(), Isis::CubeIoHandler::read(), Isis::EditTool::redoEdit(), Isis::CubeIoHandler::synchronousWrite(), Isis::EditTool::undoEdit(), and Isis::EditTool::writeToCube().
|
inlineinherited |
Returns the number of samples in the shape buffer.
Definition at line 86 of file Buffer.h.
References Isis::Buffer::p_nsamps.
Referenced by Isis::CubeIoHandler::bufferLessThan(), Isis::CubeViewport::cubeDataChanged(), Isis::ViewportBuffer::fillBuffer(), Isis::CubeIoHandler::findIntersection(), Isis::ImageImporter::operator()(), Isis::CubeIoHandler::read(), Isis::RegionalCachingAlgorithm::recommendChunksToFree(), Isis::EditTool::redoEdit(), Isis::Hillshade::shadedValue(), Isis::CubeIoHandler::synchronousWrite(), Isis::EditTool::undoEdit(), Isis::StreamExporter::writeGrayscale(), Isis::QtExporter::writeGrayscale(), Isis::StreamExporter::writeRgb(), Isis::QtExporter::writeRgb(), Isis::StreamExporter::writeRgba(), Isis::QtExporter::writeRgba(), and Isis::EditTool::writeToCube().
|
inlineprotectedinherited |
This method is used to set the base band position of the shape buffer.
start_band | Starting band to set |
Definition at line 209 of file Buffer.h.
References Isis::Buffer::p_band.
Referenced by Isis::Brick::SetBaseBand(), and Isis::Buffer::SetBasePosition().
|
inlineprotectedinherited |
This method is used to set the base line position of the shape buffer.
start_line | Starting line to set |
Definition at line 199 of file Buffer.h.
References Isis::Buffer::p_line.
Referenced by Isis::Brick::SetBaseLine(), and Isis::Buffer::SetBasePosition().
|
protectedinherited |
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.
start_sample | Starting sample to set. |
start_line | Starting line to set. |
start_band | Starting band to set. |
Definition at line 122 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().
|
inlineprotectedinherited |
This method is used to set the base sample position of the shape buffer.
start_samp | Starting sample to set |
Definition at line 189 of file Buffer.h.
References Isis::Buffer::p_sample.
Referenced by Isis::Buffer::SetBasePosition(), and Isis::Brick::SetBaseSample().
|
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
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 p_hotLine, and p_hotSample.
|
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.
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::ProcessMosaic::BandPriorityWithNoTracking(), Isis::ControlPointEditWidget::demRadius(), Isis::QnetTool::demRadius(), Isis::InterestOperator::InterestByMeasure(), Isis::DemShape::localRadius(), Isis::ProcessMosaic::ResetCountBands(), Isis::FileTool::saveAs_FullResolution(), and Isis::AdvancedTrackTool::TrackMosaicOrigin().
|
inlineinherited |
Returns the total number of pixels in the shape buffer.
Definition at line 113 of file Buffer.h.
References Isis::Buffer::p_npixels.
Referenced by Isis::CubeDataThreadTester::BrickChanged(), Isis::Process::CalculateStatistics(), Isis::Buffer::Copy(), Isis::Buffer::CopyOverlapFrom(), Isis::ViewportBuffer::DataReady(), Isis::ViewportBuffer::fillBuffer(), Isis::ProcessMapMosaic::FillNull(), Isis::Cube::histogram(), Isis::ProcessExport::isisOut16s(), Isis::ProcessExport::isisOut16u(), Isis::ProcessExport::isisOut32(), Isis::ProcessExport::isisOut8(), Isis::Average::operator()(), Isis::CubeDataThread::OverlapIndex(), Isis::Calculator::Push(), Isis::CubeIoHandler::read(), Isis::CubeDataThreadTester::ReadBrick(), Isis::CubeDataThreadTester::ReadWriteBrick(), Isis::ProcessMosaic::ResetCountBands(), Isis::Hillshade::shadedValue(), Isis::AutoReg::SobelGradient(), Isis::ProcessByBoxcar::StartProcess(), Isis::ProcessExport::StartProcess(), Isis::Cube::statistics(), and Isis::EditTool::writeToCube().
|
protectedinherited |
Starting band to read/write.
Definition at line 220 of file Buffer.h.
Referenced by Isis::Buffer::Band(), Isis::Buffer::Buffer(), Isis::Buffer::CopyOverlapFrom(), Isis::Buffer::Index(), and Isis::Buffer::SetBaseBand().
|
protectedinherited |
Shape buffer allocated to the size of npixels for handling reads/writes.
Definition at line 224 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().
|
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().
|
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().
|
protectedinherited |
Starting line to read/write.
Definition at line 217 of file Buffer.h.
Referenced by Isis::Buffer::Buffer(), Isis::Buffer::CopyOverlapFrom(), Isis::Buffer::Index(), Isis::Buffer::Line(), and Isis::Buffer::SetBaseLine().
|
protectedinherited |
Number of bands to read/write.
Definition at line 221 of file Buffer.h.
Referenced by Isis::Buffer::BandDimension(), Isis::Buffer::Buffer(), Isis::Buffer::CopyOverlapFrom(), Isis::Buffer::Index(), and Isis::Brick::Resize().
|
protectedinherited |
Number of lines to read/write.
Definition at line 218 of file Buffer.h.
Referenced by Isis::Buffer::Band(), Isis::Buffer::Buffer(), Isis::Buffer::CopyOverlapFrom(), Isis::Buffer::Index(), Isis::Buffer::Line(), Isis::Buffer::LineDimension(), and Isis::Brick::Resize().
|
protectedinherited |
Number of pixels (nsamps * nlines * nbands)
Definition at line 223 of file Buffer.h.
Referenced by Isis::Buffer::Allocate(), Isis::Buffer::at(), Isis::Buffer::Buffer(), Isis::Buffer::Copy(), Isis::Buffer::CopyOverlapFrom(), Isis::Buffer::operator=(), Isis::Brick::Resize(), and Isis::Buffer::size().
|
protectedinherited |
Number of samples to read/write.
Definition at line 215 of file Buffer.h.
Referenced by Isis::Buffer::Band(), Isis::Buffer::Buffer(), Isis::Buffer::CopyOverlapFrom(), Isis::Buffer::Index(), Isis::Buffer::Line(), Isis::Brick::Resize(), Isis::Buffer::Sample(), and Isis::Buffer::SampleDimension().
|
protectedinherited |
The pixel type of the raw buffer.
Definition at line 227 of file Buffer.h.
Referenced by Isis::Buffer::Allocate(), Isis::Buffer::Copy(), and Isis::Buffer::PixelType().
|
protectedinherited |
The raw dm read from the disk.
Definition at line 228 of file Buffer.h.
Referenced by Isis::Buffer::Allocate(), Isis::Buffer::Copy(), Isis::Buffer::RawBuffer(), Isis::Brick::Resize(), and Isis::Buffer::~Buffer().
|
protectedinherited |
Starting sample to read/write.
Definition at line 214 of file Buffer.h.
Referenced by Isis::Buffer::Buffer(), Isis::Buffer::CopyOverlapFrom(), Isis::Buffer::Index(), Isis::Buffer::Sample(), and Isis::Buffer::SetBaseSample().