12#include "SpecialPixel.h"
43 const int nbands,
const Isis::PixelType type) :
50 string message =
"Invalid value for sample dimensions (nsamps)";
51 throw IException(IException::Programmer, message, _FILEINFO_);
54 string message =
"Invalid value for line dimensions (nlines)";
55 throw IException(IException::Programmer, message, _FILEINFO_);
58 string message =
"Invalid value for band dimensions (nbands)";
59 throw IException(IException::Programmer, message, _FILEINFO_);
108 const int start_line,
109 const int start_band) {
181 i_line =
Line(index);
182 i_band =
Band(index);
201 QString message = Message::ArraySubscriptNotInRange(i_samp);
202 throw IException(IException::Programmer, message, _FILEINFO_);
206 QString message = Message::ArraySubscriptNotInRange(i_line);
207 throw IException(IException::Programmer, message, _FILEINFO_);
211 QString message = Message::ArraySubscriptNotInRange(i_band);
212 throw IException(IException::Programmer, message, _FILEINFO_);
234 QString message = Message::ArraySubscriptNotInRange(index);
235 throw IException(IException::Programmer, message, _FILEINFO_);
238 QString message = Message::ArraySubscriptNotInRange(index);
239 throw IException(IException::Programmer, message, _FILEINFO_);
258 string message =
"Input and output buffers are not the same size";
259 throw IException(IException::Programmer, message, _FILEINFO_);
263 string message =
"Input and output buffers are not the same pixel type";
264 throw IException(IException::Programmer, message, _FILEINFO_);
267 size_t n =
sizeof(double);
287 bool isSubareaOfIn =
true;
293 isSubareaOfIn =
false;
299 isSubareaOfIn =
false;
311 for (
int b = firstBand; b < lastBand; b++) {
312 for (
int i = topLine; i < bottomLine; i++) {
313 for (
int j = topSamp; j < bottomSamp; j++) {
315 (*this)[
Index(j, i, b)] = in[in.
Index(j, i, b)];
318 (*this)[
Index(j, i, b)] = NULL8;
325 return isSubareaOfIn;
379 QString message = Message::MemoryAllocationFailed();
380 throw IException(IException::Unknown, message, _FILEINFO_);
int size() const
Returns the total number of pixels in the shape buffer.
void * p_rawbuf
The raw dm read from the disk.
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.
int Line(const int index=0) const
Returns the line position associated with a shape buffer index.
Buffer()
Default constructor for proper initialization purposes.
int p_npixels
Number of pixels (nsamps * nlines * nbands)
void Allocate()
Size or resize the memory buffer.
int p_nlines
Number of lines to read/write.
int p_nbands
Number of bands to read/write.
Buffer & operator=(const double &d)
Assign the entire buffer to a constant double value.
bool CopyOverlapFrom(const Buffer &in)
Allows copying of the buffer contents of a larger buffer to another same size or smaller Buffer,...
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.
void SetBaseLine(const int start_line)
This method is used to set the base line position of the shape buffer.
double * p_buf
Shape buffer allocated to the size of npixels for handling reads/writes.
Isis::PixelType PixelType() const
Returns the raw buffer pixel type.
int Band(const int index=0) const
Returns the band position associated with a shape buffer index.
int p_sample
Starting sample to read/write.
const Isis::PixelType p_pixelType
The pixel type of the raw buffer.
int p_band
Starting band to read/write.
void Copy(const Buffer &in, bool includeRawBuf=true)
Allows copying of the buffer contents to another Buffer.
double at(const int index) const
Returns the value in the shape buffer at the given index.
int p_nsamps
Number of samples to read/write.
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.
int p_line
Starting line to read/write.
int Sample(const int index=0) const
Returns the sample position associated with a shape buffer index.
void SetBaseBand(const int start_band)
This method is used to set the base band 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.
~Buffer()
Destroys the Buffer object and frees shape buffer.
This is free and unencumbered software released into the public domain.
Namespace for the standard library.