UsTK : Ultrasound ToolKit  version 2.0.1 under development (2023-12-07)
usPreScanToPostScan3DConverter Class Reference

#include <visp3/ustk_core/usPreScanToPostScan3DConverter.h>

Public Types

enum  usConverterOptimizationMethod {
  SINGLE_THREAD_DIRECT_CONVERSION , MULTI_THREAD_DIRECT_CONVERSION , GPU_DIRECT_CONVERSION , SINGLE_THREAD_FULL_LOOKUP_TABLE ,
  MULTI_THREAD_FULL_LOOKUP_TABLE , GPU_FULL_LOOKUP_TABLE , SINGLE_THREAD_REDUCED_LOOKUP_TABLE , MULTI_THREAD_REDUCED_LOOKUP_TABLE ,
  GPU_REDUCED_LOOKUP_TABLE
}
 

Public Member Functions

 usPreScanToPostScan3DConverter ()
 
 usPreScanToPostScan3DConverter (const usImagePreScan3D< unsigned char > &preScanImage, double down)
 
virtual ~usPreScanToPostScan3DConverter ()
 
void convert (usImagePostScan3D< unsigned char > &postScanImage, const usImagePreScan3D< unsigned char > &preScanImage)
 
void init (const usImagePreScan3D< unsigned char > &preScanImage, double down=1)
 
void setConverterOptimizationMethod (usConverterOptimizationMethod method)
 
usConverterOptimizationMethod setConverterOptimizationMethod () const
 
double getResolution () const
 
void SweepInZdirection (bool flag)
 

Protected Attributes

usConverterOptimizationMethod m_converterOptimizationMethod
 
usConverterOptimizationMethod m_conversionOptimizationMethodUsedAtInit
 
std::vector< usVoxelWeightAndIndex > m_lookupTables [2]
 
std::vector< usVoxelWeightAndIndexReducedMemory > m_reducedLookupTables [2]
 
void * m_GPULookupTables [2]
 
long int m_GPULookupTablesSize [2]
 
usImagePreScan3D< unsigned char > m_VpreScan
 
double m_downSamplingFactor
 
double m_resolution
 
bool m_SweepInZdirection
 
unsigned int m_nbX
 
unsigned int m_nbY
 
unsigned int m_nbZ
 
bool m_initDone
 

Detailed Description

3D scan converter

This class allows to convert 3D pre-scan ultrasound images to post-scan. The converter can be initialized through init() and then applied through convert(). This class accepts only images acquired by a convex transducer and a tilting motor for now. The optimization method used to perform the conversion can be set through setConverterOptimizationMethod() before the call to init().

Warning
Converting with *_REDUCED_LOOKUP_TABLE or *_FULL_LOOKUP_TABLE optimizations method can use a lot of RAM when computing the LUTs in init().
Converting with *_DIRECT_CONVERSION optimization methods can lead to long conversion time.

Considering the following usImagePreScan3D image as input:

this class generates an usImagePostScan3D (convex or linear) as output:

Here is an example of how to use this converter :

#include <visp3/ustk_core/usPreScanToPostScan3DConverter.h>
int main()
{
// example of 3D pre-scan image settings
unsigned int width = 320;
unsigned int height = 240;
unsigned int frames = 10;
double transducerRadius = 0.045;
double scanLinePitch = 0.0012;
unsigned int scanLineNumber = width;
bool isTransducerConvex = true;
double axialResolution = 0.002;
double framePitch = 0.002;
double motorRadius = 0.04;
usImage3D<unsigned char> I(height, width, frames);
usImagePreScan3D <unsigned char> preScan; // your input pre-scan image
// then you can fill the preScan image and settings
preScan.setTransducerRadius(transducerRadius);
preScan.setScanLinePitch(scanLinePitch);
preScan.setScanLineNumber(scanLineNumber);
preScan.setTransducerConvexity(isTransducerConvex);
preScan.setAxialResolution(axialResolution);
preScan.setMotorRadius(motorRadius);
preScan.setFramePitch(framePitch);
preScan.setData(I);
//scan-converster
converter.init(preScan);
converter.convert(postscanImage, preScan);
}
void setScanLineNumber(unsigned int scanLineNumber)
void setData(const usImage3D< Type > &image)
void setAxialResolution(const double axialResolution)
void setMotorType(const usMotorType &motorType)
void setMotorRadius(double motorRadius)
void setFramePitch(double framePitch)
void init(const usImagePreScan3D< unsigned char > &preScanImage, double down=1)
void convert(usImagePostScan3D< unsigned char > &postScanImage, const usImagePreScan3D< unsigned char > &preScanImage)
void setTransducerConvexity(const bool isTransducerConvex)
void setScanLinePitch(const double scanLinePitch)
void setTransducerRadius(const double transducerRadius)

Definition at line 109 of file usPreScanToPostScan3DConverter.h.

Member Enumeration Documentation

◆ usConverterOptimizationMethod

Enumerator
SINGLE_THREAD_DIRECT_CONVERSION 
MULTI_THREAD_DIRECT_CONVERSION 
GPU_DIRECT_CONVERSION 
SINGLE_THREAD_FULL_LOOKUP_TABLE 
MULTI_THREAD_FULL_LOOKUP_TABLE 
GPU_FULL_LOOKUP_TABLE 
SINGLE_THREAD_REDUCED_LOOKUP_TABLE 
MULTI_THREAD_REDUCED_LOOKUP_TABLE 
GPU_REDUCED_LOOKUP_TABLE 

Definition at line 112 of file usPreScanToPostScan3DConverter.h.

Constructor & Destructor Documentation

◆ usPreScanToPostScan3DConverter() [1/2]

usPreScanToPostScan3DConverter::usPreScanToPostScan3DConverter ( )

Default constructor.

Definition at line 47 of file usPreScanToPostScan3DConverter.cpp.

◆ usPreScanToPostScan3DConverter() [2/2]

usPreScanToPostScan3DConverter::usPreScanToPostScan3DConverter ( const usImagePreScan3D< unsigned char > &  preScanImage,
double  down 
)

Initialisation constructor.

Parameters
preScanImagePre-scan image to convert, with settings filled (transducer and motor).
downDownsampling factor (sample number divided by this number).

Definition at line 59 of file usPreScanToPostScan3DConverter.cpp.

References init().

◆ ~usPreScanToPostScan3DConverter()

usPreScanToPostScan3DConverter::~usPreScanToPostScan3DConverter ( )
virtual

Destructor.

Definition at line 439 of file usPreScanToPostScan3DConverter.cpp.

Member Function Documentation

◆ convert()

◆ getResolution()

double usPreScanToPostScan3DConverter::getResolution ( ) const
inline

Definition at line 174 of file usPreScanToPostScan3DConverter.h.

References m_resolution.

◆ init()

◆ setConverterOptimizationMethod() [1/2]

usConverterOptimizationMethod usPreScanToPostScan3DConverter::setConverterOptimizationMethod ( ) const
inline

Definition at line 172 of file usPreScanToPostScan3DConverter.h.

References m_converterOptimizationMethod.

◆ setConverterOptimizationMethod() [2/2]

void usPreScanToPostScan3DConverter::setConverterOptimizationMethod ( usConverterOptimizationMethod  method)

◆ SweepInZdirection()

void usPreScanToPostScan3DConverter::SweepInZdirection ( bool  flag)
inline

Definition at line 176 of file usPreScanToPostScan3DConverter.h.

References m_SweepInZdirection.

Member Data Documentation

◆ m_conversionOptimizationMethodUsedAtInit

usConverterOptimizationMethod usPreScanToPostScan3DConverter::m_conversionOptimizationMethodUsedAtInit
protected

Definition at line 142 of file usPreScanToPostScan3DConverter.h.

Referenced by init().

◆ m_converterOptimizationMethod

usConverterOptimizationMethod usPreScanToPostScan3DConverter::m_converterOptimizationMethod
protected

Definition at line 141 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), init(), and setConverterOptimizationMethod().

◆ m_downSamplingFactor

double usPreScanToPostScan3DConverter::m_downSamplingFactor
protected

Definition at line 152 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), and init().

◆ m_GPULookupTables

void* usPreScanToPostScan3DConverter::m_GPULookupTables[2]
protected

Definition at line 147 of file usPreScanToPostScan3DConverter.h.

◆ m_GPULookupTablesSize

long int usPreScanToPostScan3DConverter::m_GPULookupTablesSize[2]
protected

Definition at line 148 of file usPreScanToPostScan3DConverter.h.

Referenced by init().

◆ m_initDone

bool usPreScanToPostScan3DConverter::m_initDone
protected

Definition at line 160 of file usPreScanToPostScan3DConverter.h.

Referenced by init().

◆ m_lookupTables

std::vector<usVoxelWeightAndIndex> usPreScanToPostScan3DConverter::m_lookupTables[2]
protected

Definition at line 145 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), and init().

◆ m_nbX

unsigned int usPreScanToPostScan3DConverter::m_nbX
protected

Definition at line 156 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), and init().

◆ m_nbY

unsigned int usPreScanToPostScan3DConverter::m_nbY
protected

Definition at line 157 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), and init().

◆ m_nbZ

unsigned int usPreScanToPostScan3DConverter::m_nbZ
protected

Definition at line 158 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), and init().

◆ m_reducedLookupTables

std::vector<usVoxelWeightAndIndexReducedMemory> usPreScanToPostScan3DConverter::m_reducedLookupTables[2]
protected

Definition at line 146 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), and init().

◆ m_resolution

double usPreScanToPostScan3DConverter::m_resolution
protected

Definition at line 153 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), getResolution(), and init().

◆ m_SweepInZdirection

bool usPreScanToPostScan3DConverter::m_SweepInZdirection
protected

Definition at line 154 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), and SweepInZdirection().

◆ m_VpreScan

usImagePreScan3D<unsigned char> usPreScanToPostScan3DConverter::m_VpreScan
protected

Definition at line 150 of file usPreScanToPostScan3DConverter.h.

Referenced by convert(), and init().