39 #ifndef __usImagePreScan3D_h_
40 #define __usImagePreScan3D_h_
42 #include <visp3/ustk_core/usImage3D.h>
43 #include <visp3/ustk_core/usImagePreScan2D.h>
45 #include <visp3/ustk_core/usImagePreScanSettings.h>
47 #include <visp3/ustk_core/usMotorSettings.h>
138 template <
class Type>
169 void resize(
unsigned int height,
unsigned int width,
unsigned int numberOfFrames);
175 template <
class Type>
186 template <
class Type>
192 throw(vpException(vpException::badValue,
"3D pre-scan image X-size differ from transducer scan line number"));
194 throw(vpException(vpException::badValue,
"3D pre-scan image Z-size differ from motor frame number"));
201 template <
class Type>
235 usMotorSettings::operator==(other));
243 return out << static_cast<const usImage3D<Type> &>(other) <<
static_cast<const usImagePreScanSettings &
>(other)
262 setScanLineNumber(image.
getWidth());
299 template <
class Type>
315 if (index > this->getNumberOfFrames())
316 throw(vpException(vpException::badValue,
"usImage3D::insertFrame : frame index out of volume"));
318 if (frame.getHeight() != this->getHeight() || frame.getWidth() != this->getWidth())
319 throw(vpException(vpException::badValue,
"usImage3D::insertFrame : frame size don't match volume size"));
322 int offset = index * this->getHeight() * this->getWidth();
323 Type *frameBeginning = this->getData() + offset;
326 for (
unsigned int i = 0; i < this->getWidth(); i++) {
327 for (
unsigned int j = 0; j < this->getHeight(); j++) {
328 frameBeginning[i + this->getWidth() * j] = frame[j][i];
342 if (index > this->getNumberOfFrames() - 1)
343 throw(vpException(vpException::badValue,
"usImage3D::getFrame : frame index out of volume"));
345 image.
resize(this->getHeight(), this->getWidth());
348 int offset = index * this->getHeight() * this->getWidth();
349 const Type *frameBeginning = this->getConstData() + offset;
352 for (
unsigned int i = 0; i < this->getWidth(); i++) {
353 for (
unsigned int j = 0; j < this->getHeight(); j++) {
354 image[j][i] = frameBeginning[i + this->getWidth() * j];
Representation of a physical image volume.
unsigned int getNumberOfFrames() const
void resize(unsigned int height, unsigned int width, unsigned int numberOfFrames)
unsigned int getHeight() const
unsigned int getWidth() const
usImage3D< Type > & operator=(const usImage3D< Type > &other)
2D pre-scan ultrasound image.
void resize(const unsigned int h, const unsigned int w)
3D pre-scan ultrasound image.
void getFrame(usImagePreScan2D< Type > &image, unsigned int index)
void setScanLineNumber(unsigned int scanLineNumber)
usImagePreScan3D< Type > & operator=(const usImagePreScan3D< Type > &other)
void setData(const usImage3D< Type > &image)
bool operator==(const usImagePreScan3D< Type > &other)
virtual ~usImagePreScan3D()
void setFrameNumber(unsigned int frameNumber)
void resize(unsigned int height, unsigned int width, unsigned int numberOfFrames)
void insertFrame(const usImagePreScan2D< Type > &frame, unsigned int index)
usImagePreScan3D(const usImage3D< Type > &image, const usImagePreScanSettings &preScanSettings, const usMotorSettings &motorSettings)
usImagePreScan3D(const usImagePreScan3D &other)
unsigned int getBModeSampleNumber() const
Settings associated to ultrasound pre-scan images implemented in usImageRF2D, usImageRF3D,...
usImagePreScanSettings & operator=(const usImagePreScanSettings &other)
Generic class for 3D ultrasound motor settings associated to the 3D probe used during acquisition.
usMotorSettings & operator=(const usMotorSettings &other)
unsigned int getFrameNumber() const
void setFrameNumber(unsigned int frameNumber)
unsigned int getScanLineNumber() const
void setScanLineNumber(unsigned int scanLineNumber)