Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "cmtkImageSymmetryPlaneFunctionalDevice.h"
00034
00035 #include <GPU/cmtkImagePairAffineRegistrationFunctionalDevice_kernels.h>
00036
00037 namespace
00038 cmtk
00039 {
00040
00043
00044 ImageSymmetryPlaneFunctionalDevice::ImageSymmetryPlaneFunctionalDevice
00045 ( UniformVolume::SmartConstPtr& volume )
00046 : ImageSymmetryPlaneFunctionalBase( volume ),
00047 m_VolumeOnDevice( DeviceUniformVolumeArray::Create( *(this->m_Volume) ) )
00048 {
00049 }
00050
00051 ImageSymmetryPlaneFunctionalDevice::ImageSymmetryPlaneFunctionalDevice
00052 ( UniformVolume::SmartConstPtr& volume,
00053 const Types::DataItemRange& valueRange )
00054 : ImageSymmetryPlaneFunctionalBase( volume, valueRange ),
00055 m_VolumeOnDevice( DeviceUniformVolumeArray::Create( *(this->m_Volume) ) )
00056 {
00057 }
00058
00059 ImageSymmetryPlaneFunctionalDevice::ReturnType
00060 ImageSymmetryPlaneFunctionalDevice::Evaluate()
00061 {
00062 const AffineXform::MatrixType mirrorMatrix = this->m_ParametricPlane.GetMirrorXformMatrix();
00063
00064 float matrix[4][4];
00065 for ( size_t j = 0; j < 4; ++j )
00066 {
00067 for ( size_t i = 0; i < 4; ++i )
00068 {
00069 matrix[j][i] = static_cast<float>( mirrorMatrix[j][i] );
00070 }
00071 }
00072
00073 FixedVector<3,float> deltas = this->m_Volume->Deltas();
00074
00075
00076 for ( size_t j = 0; j < 3; ++j )
00077 {
00078 for ( size_t i = 0; i < 3; ++i )
00079 {
00080 matrix[j][i] *= deltas[j];
00081 }
00082 }
00083
00084
00085 for ( size_t j = 0; j < 4; ++j )
00086 {
00087 for ( size_t i = 0; i < 3; ++i )
00088 {
00089 matrix[j][i] /= this->m_Volume->Size[i];
00090 }
00091 }
00092
00093 return -ImagePairAffineRegistrationFunctionalDeviceEvaluateMSD( this->m_Volume->m_Dims.begin(), this->m_VolumeOnDevice->GetDeviceArrayPtr()->GetArrayOnDevice(),
00094 this->m_Volume->m_Dims.begin(), this->m_VolumeOnDevice->GetDeviceArrayPtr()->GetArrayOnDevice(), matrix );
00095 }
00096
00097 }