38 #ifndef __usImageRF2D_h_
39 #define __usImageRF2D_h_
43 #include <visp3/ustk_core/usImagePreScanSettings.h>
131 const Type *
getSignal(
unsigned int scanlineIndex)
const;
136 void init(
unsigned int height,
unsigned int width);
143 void operator()(
unsigned int i,
unsigned int j,
const Type &value);
147 void resize(
const unsigned int height,
const unsigned int width);
148 void resize(
const unsigned int height,
const unsigned int width,
const Type &val);
152 unsigned int npixels;
163 template <
class Type>
173 template <
class Type>
186 template <
class Type>
191 throw(vpException(vpException::badValue,
"RF image width differ from transducer scan line number"));
201 template <
class Type>
209 memcpy(bitmap, other.
getBitmap(), (
size_t)(height * width *
sizeof(Type)));
217 if (bitmap != NULL) {
234 memcpy(bitmap, other.
getBitmap(), height * width *
sizeof(Type));
248 if (this->width != other.
getWidth())
253 for (
unsigned int i = 0; i < npixels; i++) {
254 if (bitmap[i] != other.bitmap[i]) {
269 if (i >= height || j >= width)
270 throw vpException(vpException::dimensionError,
"usImageRF2D, try to acess index out of image bounds");
283 if (i >= height || j >= width)
284 throw vpException(vpException::dimensionError,
"usImageRF2D, try to write at index out of image bounds");
292 template <
class Type> std::ostream &operator<<(std::ostream &out,
const usImageRF2D<Type> &other)
294 return out << static_cast<const usImagePreScanSettings &>(other) <<
"image height : " << other.
getHeight()
296 <<
"image width : " << other.
getWidth() << std::endl
297 <<
"number of A-samples in a scan line : " << other.
getRFSampleNumber() << std::endl
315 if (scanLineNumber != getWidth())
316 resize(this->getHeight(), scanLineNumber);
330 this->init(height, width);
331 this->setScanLineNumber(width);
342 template <
class Type>
345 this->init(height, width);
346 this->setScanLineNumber(width);
349 for (
unsigned int n = 0; n < this->npixels; n++) {
373 if (width != this->width) {
380 if ((height != this->height) || (width != this->width)) {
381 if (bitmap != NULL) {
387 this->height = height;
389 npixels = width * height;
391 bitmap =
new Type[npixels];
393 if (bitmap == NULL) {
394 throw(vpException(vpException::memoryAllocationError,
"cannot allocate bitmap "));
398 col =
new Type *[width];
400 throw(vpException(vpException::memoryAllocationError,
"cannot allocate col "));
404 for (j = 0; j < width; j++)
405 col[j] = bitmap + j * height;
439 return col[scanlineIndex];
Settings associated to ultrasound pre-scan images implemented in usImageRF2D, usImageRF3D,...
void setImagePreScanSettings(const usImagePreScanSettings &preScanSettings)
bool operator==(const usImagePreScanSettings &other)
usImagePreScanSettings & operator=(const usImagePreScanSettings &other)
2D Radio Frequence (RF) ultrasound image.
bool operator==(const usImageRF2D< Type > &other)
void operator()(unsigned int i, unsigned int j, const Type &value)
usImageRF2D(unsigned int height, unsigned int width)
usImageRF2D< Type > & operator=(const usImageRF2D< Type > &other)
unsigned int getNumberOfPixel() const
void setScanLineNumber(unsigned int scanLineNumber)
unsigned int getHeight() const
void resize(const unsigned int height, const unsigned int width, const Type &val)
usImageRF2D(const usImageRF2D &other)
friend class usRawFileParser
void resize(const unsigned int height, const unsigned int width)
const Type * getSignal(unsigned int scanlineIndex) const
Type operator()(unsigned int i, unsigned int j) const
operator() allows to access/modify RF samples values in the image.
unsigned int getWidth() const
void init(unsigned int height, unsigned int width)
Set the size of the image.
const Type * getBitmap() const
usImageRF2D()
Constructor.
unsigned int getRFSampleNumber() const
usImageRF2D(unsigned int height, unsigned int width, const usImagePreScanSettings &preScanSettings)
Specific class to grab RF frames from the ultrasound station on the network.
Specific class to grab RF volumes from the ultrasound station on the network.
unsigned int getScanLineNumber() const
void setScanLineNumber(unsigned int scanLineNumber)
Class to simulate a server sending frames from an ultrasound station. Permits to replay a sequence of...