SLIMMER
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes
SliceIntersection Class Reference

A class for the intersection between two slices. More...

#include <SliceIntersection.h>

List of all members.

Public Member Functions

 SliceIntersection ()
 Constructor.
 ~SliceIntersection ()
 Destructor.
template<typename T , typename T1 >
 SliceIntersection (const Stack< T, T1 > &ss1, unsigned int ll1, const Stack< T, T1 > &ss2, unsigned int ll2, const float mindim=0.0f, const float sigma=0.0, const SimpleTField< float > *mask=NULL)
 Constructor, using two stack objects, two slice indices, and the minimal voxel dimension length.
template<typename T , typename T1 >
 SliceIntersection (const Stack< T, T1 > &ss1, unsigned int ll1, const LinTransParam< float > &dof1, const Stack< T, T1 > &ss2, unsigned int ll2, const LinTransParam< float > &dof2, const float mindim=0.0f, const float sigma=0.0, const SimpleTField< float > *mask=NULL)
 Constructor, using two stack objects, two slice indices, two slice motion parameters and the minimal voxel dimension length.
template<typename T , typename T1 >
 SliceIntersection (const Stack< T, T1 > &ss1, unsigned int ll1, const Stack< T, T1 > &ss2, unsigned int ll2, const vector< SimpleTMat< float, 4, 4 > > Ms1, const vector< SimpleTMat< float, 4, 4 > > Ms2, const float mindim=0.0f, const float sigma=0.0, const SimpleTField< float > *mask=NULL)
 Constructor, using two stack objects, two slice indices, and two vector objects of slice motion (see below) and the minimal voxel dimension length.
template<typename T , typename T1 >
unsigned int ComputeLocsFlo (const SimpleTVec< float, 3 > &pf_ref, const SimpleTVec< float, 3 > &intx_vec_ref, const Stack< T, T1 > &ss1, const Stack< T, T1 > &ss2, SimpleVTVec< SimpleTVec< float, 3 > > &locs1, SimpleVTVec< SimpleTVec< float, 3 > > &locs2, const SimpleTField< float > *mask=NULL)
 Computes intersection locations in the floating frame.
float ComputeIntxInRef (SimpleTVec< float, 3 > &pfoot, SimpleTVec< float, 3 > &ivec) const
 Given the current rotation matrices for two slices, computes the center point and the direction of the intersection line.
void Nullify ()
 Nullify the intersection, when intersection is not defined.
int getNSample () const
 Access to class variable.
const SimpleVTVec< float > & getImg (int ii) const
 image profile along the intersection line of the ii-th slice. (ii=1, 2)
SimpleVTVec< float > getDiff (int ii) const
 intensity difference along the intersection line of the ii-th slice. (getDiff(1)=-getDiff(2))
const SimpleVTVec< float > & getXgrad (int ii) const
 x-gradient along the intersection line of the ii-th slice.
const SimpleVTVec< float > & getYgrad (int ii) const
 y-gradient along the intersection line of the ii-th slice.
const SimpleVTVec< SimpleTVec
< float, 3 > > & 
getlocs (int ii) const
 voxel location within slice of the ii-th slice.
void Printdof () const
 prints the DOF's of both slices
void PrintImg (int ii, FILE *fid=stderr) const
 Print the intersection profile of Slice ii (1 or 2), to given file pointer.
void Printlocs (int ii, FILE *fid=stderr)
 Print the intersection locations of Slice ii (1 or 2) in ref. frame, to given file pointer.
void getPartial (SimpleVTMat< float > &partial1, SimpleVTMat< float > &partial2)
 Computes the partial derivatives of the intersection location in floating frame w.r.t. motion parameters.
void GetRefLocs (SimpleTVec< float, 3 > &loc, SimpleTVec< float, 3 > &dir) const
 Returns the location of the sampling points in the 3D reference space.
SimpleVTVec< SimpleTVec< float, 3 > > GetRefLocs () const
 Returns a vector of regularly sampled intersection line in the reference frame.
SimpleTVec< float, 3 > getFloLoc (unsigned int slice, unsigned int sample) const
 Returns the location of the sample-th sample in mm, within the n-th slice (1st or 2nd).
template<typename T >
void sample_cubicB (const SimpleTField< T > &im, const unsigned int slice, SimpleVTVec< SimpleTVec< float, 3 > > &locs, SimpleVTVec< float > &img, SimpleVTVec< float > &xgrad, SimpleVTVec< float > &ygrad)
 Cubic B-spline sampling.
template<typename T >
void sample_Gaussian (const SimpleTField< T > &im, const unsigned int slice, SimpleVTVec< SimpleTVec< float, 3 > > &locs, SimpleVTVec< float > &img, SimpleVTVec< float > &xgrad, SimpleVTVec< float > &ygrad)
 Gaussian sampling.
SimpleTVec< float, 3 > VoxLoc2mmLoc (const SimpleTVec< float, 3 > &loc, const SimpleTVec< float, 3 > &VoxSz, const SimpleTVec< int, 3 > &nVox) const
 Given the voxel location, returns the location in mm.

Static Public Member Functions

static void evaluateBasis (float t, float *y, float *dy)
 computes cubic b-spline basis at t, for y and dy

Static Public Attributes

static const char _versionID [] = "$Id: SliceIntersection.h,v 1.8 2012/02/13 18:51:42 kio Exp $"

Protected Attributes

SimpleVTVec< SimpleTVec< float, 3 > > _locs1
 Voxel location of the sampling points of the intersection line, within slice 1.
SimpleVTVec< float > _prof1
 Intensity profile at sampled points, within slice 1.
SimpleVTVec< float > _xgrad1
 x-gradient profile at sampled points, within slice 1
SimpleVTVec< float > _ygrad1
 y-gradient profile at sampled points, within slice 1
LinTransParam< float > _dof1
 concatenated DOF of slice 1
SimpleTVec< float, 3 > _VoxSz1
 voxel dimensions of slice 1
SimpleTMat< float, 4, 4 > _M1
 Transformation matrix.
SimpleTMat< float, 4, 4 > _M1inv
 Transformation matrix.
SimpleTMat< float, 4, 4 > _M1d1
 Transformation matrix.
SimpleTMat< float, 4, 4 > _M1d2
 Transformation matrix.
SimpleTMat< float, 4, 4 > _M1d3
 Transformation matrix.
SimpleTVec< int, 3 > _nVox1
 image size of slice 1
SimpleVTVec< SimpleTVec< float, 3 > > _locs2
 Voxel location of the sampling points of the intersection line, within slice 2.
SimpleVTVec< float > _prof2
 Intensity profile at sampled points, within slice 2.
SimpleVTVec< float > _xgrad2
 x-gradient profile at sampled points, within slice 2
SimpleVTVec< float > _ygrad2
 y-gradient profile at sampled points, within slice 2
LinTransParam< float > _dof2
 concatenated DOF of slice 2
SimpleTVec< float, 3 > _VoxSz2
 voxel dimensions of slice 2
SimpleTMat< float, 4, 4 > _M2
 Transformation matrix.
SimpleTMat< float, 4, 4 > _M2inv
 Transformation matrix.
SimpleTMat< float, 4, 4 > _M2d1
 Transformation matrix.
SimpleTMat< float, 4, 4 > _M2d2
 Transformation matrix.
SimpleTMat< float, 4, 4 > _M2d3
 Transformation matrix.
SimpleTVec< int, 3 > _nVox2
 image size of slice 2
SimpleVTVec< float > _w
 weight profile
float _mindim
 the length of smallest voxel dimension
int _nsample
 number of sampled points of the intersection line
float _sigma
 standard deviation for scale space.
bool _MderivPrecalculated
 whether _Mderiv is previously calculated

Detailed Description

A class for the intersection between two slices.

Given two slices and two dof objects describing the positioning of the slices,

it computes the intersection profiles, and 3D location of the intersection line.

Author:
Kio Kim 2007-2011

Constructor & Destructor Documentation

template<typename T , typename T1 >
SliceIntersection::SliceIntersection ( const Stack< T, T1 > &  ss1,
unsigned int  ll1,
const Stack< T, T1 > &  ss2,
unsigned int  ll2,
const vector< SimpleTMat< float, 4, 4 > >  Ms1,
const vector< SimpleTMat< float, 4, 4 > >  Ms2,
const float  mindim = 0.0f,
const float  sigma = 0.0,
const SimpleTField< float > *  mask = NULL 
) [inline]

Constructor, using two stack objects, two slice indices, and two vector objects of slice motion (see below) and the minimal voxel dimension length.

Parameters:
[in]ss1Stack 1
[in]ll1Slice index of Stack 1
[in]ss2Stack 2
[in]ll2Slice index of Stack 2
[in]Ms1A vector of rotation matrix, and its derivatives w.r.t. to rotation angles, for slice 1
[in]Ms2A vector of rotation matrix, and its derivatives w.r.t. to rotation angles, for slice 2
[in]mindimintersection profile resampling step length
[in]sigmaSmoothing kernel size. If <0.4, cubic B spline is used
[in]maskPointer to mask

Member Function Documentation

float SliceIntersection::ComputeIntxInRef ( SimpleTVec< float, 3 > &  pfoot,
SimpleTVec< float, 3 > &  ivec 
) const [inline]

Given the current rotation matrices for two slices, computes the center point and the direction of the intersection line.

Parameters:
[out]pfootThe location of the intersection center (perpendicular foot of the origin onto the intersection line)
[out]ivecThe direction of the intersection line in the reference space
template<typename T , typename T1 >
unsigned int SliceIntersection::ComputeLocsFlo ( const SimpleTVec< float, 3 > &  pf_ref,
const SimpleTVec< float, 3 > &  intx_vec_ref,
const Stack< T, T1 > &  ss1,
const Stack< T, T1 > &  ss2,
SimpleVTVec< SimpleTVec< float, 3 > > &  locs1,
SimpleVTVec< SimpleTVec< float, 3 > > &  locs2,
const SimpleTField< float > *  mask = NULL 
) [inline]

Computes intersection locations in the floating frame.

Parameters:
[in]pf_refStarting point (perpendicular foot) in the reference frame
[in]intx_vec_refA unit vector along the intersection direction (sign doesn't matter) in the ref. frame
[in]ss1Stack 1 (Needed for voxel dimensions)
[in]ss2Stack 2 (Needed for voxel dimensions)
[out]locs1A vector of intersection points in the floating frame of stack 1
[out]locs2A vector of intersection points in the floating frame of stack 2
[in]maskThe pointer to mask. NULL if no mask.
int SliceIntersection::getNSample ( ) const [inline]

Access to class variable.

Returns number of sample points along the intersection line within the mask

SimpleTVec<float,3> SliceIntersection::VoxLoc2mmLoc ( const SimpleTVec< float, 3 > &  loc,
const SimpleTVec< float, 3 > &  VoxSz,
const SimpleTVec< int, 3 > &  nVox 
) const [inline]

Given the voxel location, returns the location in mm.

Parameters:
[in]locVoxel location vector (SimpleTVec)
[in]VoxSzVoxel dimensions vector (SimpleTVec)
[in]nVoxNumber of voxels vector (SimpleTVec)
 All Classes Functions Variables Typedefs