Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Class implementing a mitk::ImageToImageFilter for PAUS motion correction. More...
#include <mitkPhotoacousticMotionCorrectionFilter.h>
Public Member Functions | |
mitkClassMacro (PhotoacousticMotionCorrectionFilter, ImageToImageFilter) | |
virtual void | SetBatchSize (unsigned int _arg) |
virtual void | SetPyrScale (double _arg) |
virtual void | SetLevels (unsigned int _arg) |
virtual void | SetWinSize (unsigned int _arg) |
virtual void | SetIterations (unsigned int _arg) |
virtual void | SetPolyN (unsigned int _arg) |
virtual void | SetPolySigma (double _arg) |
virtual void | SetFlags (unsigned int _arg) |
virtual unsigned int | GetBatchSize () const |
virtual double | GetPyrScale () const |
virtual unsigned int | GetLevels () const |
virtual unsigned int | GetWinSize () const |
virtual unsigned int | GetIterations () const |
virtual unsigned int | GetPolyN () const |
virtual double | GetPolySigma () const |
virtual unsigned int | GetFlags () const |
void | SetPaInput (mitk::Image::Pointer) |
Wrapper which sets the photoacoustic image as the correct input. More... | |
mitk::Image::Pointer | GetPaInput () |
Wrapper which gets the photoacoustic image out of the correct input. More... | |
void | SetUsInput (mitk::Image::Pointer) |
Wrapper which sets the ultrasonic image as the correct input. More... | |
mitk::Image::Pointer | GetUsInput () |
Wrapper which gets the ultrasonic image out of the correct input. More... | |
mitk::Image::Pointer | GetPaOutput () |
Wrapper which gets the photoacoustic image out of the correct output. More... | |
mitk::Image::Pointer | GetUsOutput () |
Wrapper which gets the ultrasonic image out of the correct output. More... | |
![]() | |
virtual std::vector< std::string > | GetClassHierarchy () const override |
virtual const char * | GetClassName () const |
Pointer | Clone () const |
virtual void | SetInput (const InputImageType *image) |
virtual void | SetInput (unsigned int, const InputImageType *image) |
InputImageType * | GetInput (void) |
InputImageType * | GetInput (unsigned int idx) |
const InputImageType * | GetInput (void) const |
const InputImageType * | GetInput (unsigned int idx) const |
![]() | |
Pointer | Clone () const |
OutputType * | GetOutput () |
Get the output data of this image source object. More... | |
const OutputType * | GetOutput () const |
OutputType * | GetOutput (DataObjectPointerArraySizeType idx) |
const OutputType * | GetOutput (DataObjectPointerArraySizeType idx) const |
itk::DataObject::Pointer | MakeOutput (DataObjectPointerArraySizeType idx) override |
Make a DataObject of the correct type to used as the specified output. More... | |
itk::DataObject::Pointer | MakeOutput (const DataObjectIdentifierType &name) override |
virtual vtkImageData * | GetVtkImageData () |
virtual const vtkImageData * | GetVtkImageData () const |
![]() | |
OutputType * | GetOutput () |
const OutputType * | GetOutput () const |
OutputType * | GetOutput (DataObjectPointerArraySizeType idx) |
const OutputType * | GetOutput (DataObjectPointerArraySizeType idx) const |
virtual void | GraftOutput (OutputType *output) |
Graft the specified BaseData onto this BaseDataSource's output. More... | |
virtual void | GraftOutput (const DataObjectIdentifierType &key, OutputType *output) |
virtual void | GraftNthOutput (unsigned int idx, OutputType *output) |
Graft the specified base data object onto this BaseDataSource's idx'th output. More... | |
bool | Updating () const |
Access itk::ProcessObject::m_Updating. More... | |
Static Public Member Functions | |
static Pointer | New () |
![]() | |
static const char * | GetStaticNameOfClass () |
static Pointer | New () |
![]() | |
static const char * | GetStaticNameOfClass () |
static Pointer | New () |
Method for creation through the object factory. More... | |
![]() | |
static const char * | GetStaticNameOfClass () |
Protected Member Functions | |
PhotoacousticMotionCorrectionFilter () | |
~PhotoacousticMotionCorrectionFilter () override | |
void | GenerateData () override |
Apply OpenCV algorithm to compensate motion in a 2d image time series. More... | |
void | CheckInput (mitk::Image::Pointer paImage, mitk::Image::Pointer usImage) |
Validate the input images. More... | |
void | InitializeOutputIfNecessary (mitk::Image::Pointer paInput, mitk::Image::Pointer usInput, mitk::Image::Pointer paOutput, mitk::Image::Pointer usOutput) |
Assure that the output images have the same dimensions as the input images. More... | |
void | InitializeOutput (mitk::Image::Pointer input, mitk::Image::Pointer output) |
Copy the image data from the input image to the output image. More... | |
void | PerformCorrection (mitk::Image::Pointer paInput, mitk::Image::Pointer usInput, mitk::Image::Pointer paOutput, mitk::Image::Pointer usOutput) |
This method performs the actual motion compensation. More... | |
cv::Mat | GetMatrix (const mitk::Image::Pointer input, unsigned int i) |
Extract a 2d slice as OpenCV matrix. More... | |
cv::Mat | FitMatrixToChar (cv::Mat mat) |
Rescale matrix such that the values lie between 0 and 255. More... | |
void | InsertMatrixAsSlice (cv::Mat mat, mitk::Image::Pointer output, unsigned int i) |
Insert a OpenCV matrix as a slice into an image. More... | |
cv::Mat | ComputeFlowMap (cv::Mat) |
Compute the remapping map from an optical flow. More... | |
![]() | |
ImageToImageFilter () | |
~ImageToImageFilter () override | |
void | PrintSelf (std::ostream &os, itk::Indent indent) const override |
void | GenerateInputRequestedRegion () override |
![]() | |
ImageSource () | |
~ImageSource () override | |
void | GenerateData () override |
A version of GenerateData() specific for image processing filters. More... | |
virtual void | ThreadedGenerateData (const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId) |
If an imaging filter can be implemented as a multithreaded algorithm, the filter will provide an implementation of ThreadedGenerateData(). More... | |
void | PrepareOutputs () override |
This method is intentionally left blank. More... | |
virtual void | AllocateOutputs () |
The GenerateData method normally allocates the buffers for all of the outputs of a filter. More... | |
virtual void | BeforeThreadedGenerateData () |
If an imaging filter needs to perform processing after the buffer has been allocated but before threads are spawned, the filter can can provide an implementation for BeforeThreadedGenerateData(). More... | |
virtual void | AfterThreadedGenerateData () |
If an imaging filter needs to perform processing after all processing threads have completed, the filter can can provide an implementation for AfterThreadedGenerateData(). More... | |
virtual unsigned int | SplitRequestedRegion (unsigned int i, unsigned int num, OutputImageRegionType &splitRegion) |
Split the output's RequestedRegion into "num" pieces, returning region "i" as "splitRegion". More... | |
![]() | |
BaseDataSource () | |
~BaseDataSource () override | |
Class implementing a mitk::ImageToImageFilter for PAUS motion correction.
The filter takes a stack of PA and US images. It then computes the optical flow within the US image and compensates the PA and US images for the flow. Afterwards it returns the stack of PA and US images.
Definition at line 52 of file mitkPhotoacousticMotionCorrectionFilter.h.
|
protected |
Definition at line 17 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::Image::New(), and ~PhotoacousticMotionCorrectionFilter().
|
overrideprotected |
Definition at line 40 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
Referenced by PhotoacousticMotionCorrectionFilter().
|
protected |
Validate the input images.
The input images have to be non-empty, 3d and have to coincide in the length in each dimension. If any of these conditions are violated, the method will throw an invalid_argument
exception.
paImage | A mitk image |
usImage | A mitk image |
invalid_argument
exception. invalid_argument |
Definition at line 68 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References IMAGE_DIMENSION, and MITK_ERROR.
Referenced by GenerateData().
|
protected |
Compute the remapping map from an optical flow.
The optical flow cannot be used directly to compensate an image. Instead we have to generate an appropriate map.
flow | The optical flow which is the base for the remapping. |
Definition at line 163 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::ImageMappingHelper::map().
Referenced by PerformCorrection().
|
protected |
Rescale matrix such that the values lie between 0 and 255.
This method rescales the matrix such that its values lie between 0 and 255. In order to do that it uses the maximum and the minimum of the input ultrasonic image.
mat | The OpenCV matrix to be rescaled |
Definition at line 176 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References MAX_MATRIX.
Referenced by PerformCorrection().
|
overrideprotected |
Apply OpenCV algorithm to compensate motion in a 2d image time series.
This method uses two 3d mitk images. Both will be interpreted as time series of 2d images. GetInput(0)
should be a photoacoustic image whereas GetInput(1)
should be an ultrasound image. The input will be validated and then converted to OpenCV matrices. In the end the Farneback algorithm will be used to compute the optical flow in consecutive images and compensate for this flow. The Output will be two 3d mitk images of the same dimensions as the input containing the compensated data.
invalid_argument
exception will be thrown. invalid_argument |
Definition at line 212 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References CheckInput(), mitk::ImageToImageFilter::GetInput(), mitk::ImageSource::GetOutput(), InitializeOutputIfNecessary(), MITK_INFO, and PerformCorrection().
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
protected |
Extract a 2d slice as OpenCV matrix.
This method extracts slice i
from the 3-dimensional image input
and converts it to a OpenCV matrix. Internally, the mitkImageToOpenCVImageFilter is used.
input | A 3d image from which a slice is extracted as a 2d OpenCV matrix. |
i | Determines the slice to be extracted. |
Definition at line 186 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References IMAGE_DIMENSION, and mitk::Image::New().
Referenced by PerformCorrection().
mitk::Image::Pointer mitk::PhotoacousticMotionCorrectionFilter::GetPaInput | ( | ) |
Wrapper which gets the photoacoustic image out of the correct input.
This method is a wrapper around the GetInput
method. It is implemented for convenience such that you do not have to remember which input is for which image.
Definition at line 47 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::ImageToImageFilter::GetInput().
mitk::Image::Pointer mitk::PhotoacousticMotionCorrectionFilter::GetPaOutput | ( | ) |
Wrapper which gets the photoacoustic image out of the correct output.
This method is a wrapper around the GetOutput
method. It is implemented for convenience such that you do not have to remember which output is for which image.
Definition at line 60 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::ImageSource::GetOutput().
|
virtual |
|
virtual |
|
virtual |
mitk::Image::Pointer mitk::PhotoacousticMotionCorrectionFilter::GetUsInput | ( | ) |
Wrapper which gets the ultrasonic image out of the correct input.
This method is a wrapper around the GetInput
method. It is implemented for convenience such that you do not have to remember which input is for which image.
Definition at line 56 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::ImageToImageFilter::GetInput().
mitk::Image::Pointer mitk::PhotoacousticMotionCorrectionFilter::GetUsOutput | ( | ) |
Wrapper which gets the ultrasonic image out of the correct output.
This method is a wrapper around the GetOutput
method. It is implemented for convenience such that you do not have to remember which output is for which image.
Definition at line 64 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::ImageSource::GetOutput().
|
virtual |
|
protected |
Copy the image data from the input image to the output image.
This method copys the image data from input
to output
. This method assumes that the dimensions of the two images match and will not test this.
input | A mitk image |
output | A mitk image |
Definition at line 111 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::ImageAccessorBase::GetData().
Referenced by InitializeOutputIfNecessary().
|
protected |
Assure that the output images have the same dimensions as the input images.
The output images need to have the same dimensions as the input images. This will be checked here. If the dimensions do not match, the output will be reinitialized and the image data from the input images will be copied to the output images (in order to make sure that they have a valid data pointer).
paInput | Pointer to the photoacoustic input image |
usInput | Pointer to the ultrasonic input image |
paOutput | Pointer to the photoacoustic output image |
usOutput | Pointer to the ultrasonic output image |
Definition at line 94 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References IMAGE_DIMENSION, and InitializeOutput().
Referenced by GenerateData().
|
protected |
Insert a OpenCV matrix as a slice into an image.
This method converts the 2d OpenCV matrix mat
into an mitk image using the mitkOpenCVToMitkImageFilter. Afterwards it inserts the image as slice i
into the 3d mitk image output
.
mat | The matrix to be inserted as a slice |
output | The 3d image the matrix is inserted into |
i | The index of the slice to be replaced. |
Definition at line 200 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::ImageAccessorBase::GetData().
Referenced by PerformCorrection().
mitk::PhotoacousticMotionCorrectionFilter::mitkClassMacro | ( | PhotoacousticMotionCorrectionFilter | , |
ImageToImageFilter | |||
) |
|
static |
|
protected |
This method performs the actual motion compensation.
This method uses the ultrasonic input image usInput
to compute the optical flow in the time series of 2d images. Then it compensates both the usInput
and paInput
for it and saves the result in usOutput
and paOutput
respectively. In the background the OpenCV Farneback algorithm is used for the flow determination.
paInput | The photoacoustic input image |
usInput | The ultrasonic input image |
paOutput | The photoacoustic output image |
usOutput | The ultrasonic output image |
Definition at line 118 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References ComputeFlowMap(), FitMatrixToChar(), GetMatrix(), IMAGE_DIMENSION, and InsertMatrixAsSlice().
Referenced by GenerateData().
|
virtual |
|
virtual |
|
virtual |
|
virtual |
void mitk::PhotoacousticMotionCorrectionFilter::SetPaInput | ( | mitk::Image::Pointer | input | ) |
Wrapper which sets the photoacoustic image as the correct input.
This method is a wrapper around the SetInput
method. It is implemented for convenience such that you do not have to remember which input is for which image.
input | The photoacoustic image |
Definition at line 42 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::ImageToImageFilter::SetInput().
|
virtual |
|
virtual |
|
virtual |
void mitk::PhotoacousticMotionCorrectionFilter::SetUsInput | ( | mitk::Image::Pointer | input | ) |
Wrapper which sets the ultrasonic image as the correct input.
This method is a wrapper around the SetInput
method. It is implemented for convenience such that you do not have to remember which input is for which image.
input | The ultrasonic image |
Definition at line 51 of file mitkPhotoacousticMotionCorrectionFilter.cpp.
References mitk::ImageToImageFilter::SetInput().
|
virtual |