33 #include <visp3/ustk_elastography/usImageElastography.h>
39 : m_ultrasoundImage(), m_strainMap(), m_elastoImage(), m_heigthPosition(0), m_widthPosition(0)
53 const vpImage<unsigned char> &strainMap,
unsigned int heightPosition,
54 unsigned int widthPosition)
55 : m_ultrasoundImage(ultrasoundImage), m_strainMap(strainMap), m_elastoImage(), m_heigthPosition(heightPosition),
56 m_widthPosition(widthPosition)
58 computeElastographyImage();
80 unsigned int widthPosition)
83 if (m_ultrasoundImage.getHeight() < strainMap.getHeight() + heightPosition ||
84 m_ultrasoundImage.getWidth() < strainMap.getWidth() + widthPosition) {
86 vpException(vpException::dimensionError,
87 "usImageElastography::setStrainMap : the strainMap position is out of ultrasound image bounds !"));
90 m_strainMap = strainMap;
91 m_heigthPosition = heightPosition;
92 m_widthPosition = widthPosition;
93 computeElastographyImage();
102 m_ultrasoundImage = ultrasoundImage;
103 m_elastoImage.resize(m_ultrasoundImage.getHeight(), m_ultrasoundImage.getWidth(), vpRGBa(0, 0, 0, 255));
106 void usImageElastography::computeElastographyImage()
108 #ifdef VISP_HAVE_OPENMP
109 #pragma omp parallel for
111 for (
int i = 0; i < (int)m_elastoImage.getHeight(); i++) {
112 for (
unsigned int j = 0; j < m_elastoImage.getWidth(); j++) {
115 if (i >= (
int)m_heigthPosition && i < (int)(m_heigthPosition + m_strainMap.getHeight()) && j >= m_widthPosition &&
116 j < m_widthPosition + m_strainMap.getWidth()) {
117 newColor.R = m_strainMap[i - m_heigthPosition][j - m_widthPosition];
119 newColor.R = m_ultrasoundImage[i][j];
120 newColor.G = m_ultrasoundImage[i][j];
121 newColor.B = m_ultrasoundImage[i][j];
123 m_elastoImage[i][j] = newColor;
vpImage< vpRGBa > getElastoImage()
void setUltrasoundImage(const vpImage< unsigned char > &ultrasoundImage)
virtual ~usImageElastography()
void setStrainMap(const vpImage< unsigned char > &strainMap, unsigned int heightPosition, unsigned int widthPosition)
usImageElastography()
Constructor.