NPL
Neurological Programs and Libraries
|
Functions | |
ptr< MRImage > | npl::createMRImage (size_t ndim, const size_t *size, PixelT type) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable. More... | |
ptr< MRImage > | npl::createMRImage (const std::vector< size_t > &dim, PixelT type) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable. More... | |
ptr< MRImage > | npl::createMRImage (size_t ndim, const size_t *size, PixelT type, void *ptr, std::function< void(void *)> deleter) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable. More... | |
ptr< MRImage > | npl::createMRImage (const std::vector< size_t > &dim, PixelT type, void *ptr, std::function< void(void *)> deleter) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable. More... | |
std::ostream & | npl::operator<< (std::ostream &out, const MRImage &img) |
Writes out information about an MRImage. More... | |
void | npl::gaussianSmooth1D (ptr< MRImage > inout, size_t dim, double stddev) |
Gaussian smooths an image in 1 direction. Questionable whether it works. Seems to shift image. More... | |
ptr< MRImage > | npl::smoothDownsample (ptr< const MRImage > in, double sigma, double spacing=-1) |
Performs smoothing in each dimension, then downsamples so that pixel spacing is roughly equal to FWHM. More... | |
ptr< MRImage > | npl::resample (ptr< const MRImage > in, double *spacing, double(*window)(double, double)=hannWindow) |
Performs fourier resampling using fourier transform and the provided window function. More... | |
ptr< MRImage > | npl::shiftImage (ptr< MRImage > in, size_t len, double *vect) |
Uses fourier shift theorem to shift an image. More... | |
void | npl::writeComplex (std::string basename, ptr< const MRImage > in, bool absPhase=false) |
Writes a pair of images, one real, one imaginary or if absPhase is set to true then an absolute image and a phase image. More... | |
ptr< MRImage > | npl::fft_forward (ptr< const MRImage > in, const std::vector< size_t > &in_osize) |
Performs forward FFT transform in N dimensions. More... | |
ptr< MRImage > | npl::fft_backward (ptr< const MRImage > in, const std::vector< size_t > &in_osize) |
Performs inverse FFT transform in N dimensions. More... | |
int | npl::rotateImageShearKern (ptr< MRImage > inout, double rx, double ry, double rz, double(*kern)(double, double)=npl::lanczosKern) |
Rotates an image around the center using shear decomposition followed by kernel-based shearing. Rotation order is Rz, Ry, Rx, and about the center of the image. This means that 1D interpolation will be used. More... | |
int | npl::rotateImageShearFFT (ptr< MRImage > inout, double rx, double ry, double rz, double(*window)(double, double)=npl::sincWindow) |
Rotates an image around the center using shear decomposition followed by FFT-based shearing. Rotation order is Rz, Ry, Rx, and about the center of the image. More... | |
ptr< MRImage > | npl::rigidTransform (ptr< MRImage > in, double rx, double ry, double rz, double sx, double sy, double sz) |
Rigid Transforms an image. More... | |
ptr< MRImage > | npl::diffOfGauss (ptr< const MRImage > in, double sd1, double sd2) |
Computes difference of gaussians. More... | |
double | npl::overlapRatio (ptr< const MRImage > a, ptr< const MRImage > b) |
Computes the overlap of the two images' in 3-space. More... | |
ptr< MRImage > | npl::resampleNN (ptr< const MRImage > in, ptr< const MRImage > atlas, PixelT type=UNKNOWN_TYPE) |
Performs nearest neighbor resasmpling of input to atlas. More... | |
ptr< MRImage > | npl::resampleNN (ptr< const MRImage > in, double *newspace, PixelT type=UNKNOWN_TYPE) |
Performs nearest neighbor resasmpling of input to atlas. More... | |
ptr< MRImage > | npl::randImage (PixelT type, double mean, double sd, size_t x, size_t y, size_t z, size_t t) |
Create random image, with gaussian distribution. More... | |
ptr<MRImage> npl::createMRImage | ( | size_t | ndim, |
const size_t * | size, | ||
PixelT | type | ||
) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable.
ndim | number of image dimensions |
size | size of image, in each dimension |
type | Pixel type npl::PixelT |
ptr<MRImage> npl::createMRImage | ( | const std::vector< size_t > & | dim, |
PixelT | type | ||
) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable.
dim | size of image, in each dimension, number of dimensions decied by length of size vector |
type | Pixel type npl::PixelT |
ptr<MRImage> npl::createMRImage | ( | size_t | ndim, |
const size_t * | size, | ||
PixelT | type, | ||
void * | ptr, | ||
std::function< void(void *)> | deleter | ||
) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable.
ndim | number of image dimensions |
size | size of image, in each dimension |
type | Pixel type npl::PixelT |
ptr | Pointer to data block |
deleter | function to delete data block |
ptr<MRImage> npl::createMRImage | ( | const std::vector< size_t > & | dim, |
PixelT | type, | ||
void * | ptr, | ||
std::function< void(void *)> | deleter | ||
) |
Creates a new MRImage with dimensions set by ndim, and size set by size. Output pixel type is decided by type variable.
dim | size of image, in each dimension, number of dimensions decied by length of size vector |
type | Pixel type npl::PixelT |
ptr | Pointer to data block |
deleter | function to delete data block |
Computes difference of gaussians.
in | Gaussian smooths an image twice and subtracts |
sd1 | Standard deviation of first image |
sd2 | Standard deviation of second image |
Performs inverse FFT transform in N dimensions.
in | Input image |
in_osize | Size of output image. If this is smaller than the input then the frequency domain will be trunkated, if it is larger then the fourier domain will be padded ( output upsampled ) |
Performs forward FFT transform in N dimensions.
in | Input image |
in_osize | Size of output image (will be padded up to this prior to FFT) |
Gaussian smooths an image in 1 direction. Questionable whether it works. Seems to shift image.
inout | Input/Output image |
dim | Direction to smooth in |
stddev | in real space, for example millimeters. |
std::ostream & npl::operator<< | ( | std::ostream & | out, |
const MRImage & | img | ||
) |
Writes out information about an MRImage.
out | Output ostream |
img | Image to write information about |
Computes the overlap of the two images' in 3-space.
a | Image |
b | Image |
ptr<MRImage> npl::randImage | ( | PixelT | type, |
double | mean, | ||
double | sd, | ||
size_t | x, | ||
size_t | y, | ||
size_t | z, | ||
size_t | t | ||
) |
Create random image, with gaussian distribution.
type | Type of pixels |
mean | mean of Gaussian |
sd | Standard deviation of distribution |
x | X size |
y | Y size |
z | Z size |
t | Time size, default 0 time |
ptr<MRImage> npl::resample | ( | ptr< const MRImage > | in, |
double * | spacing, | ||
double(*)(double, double) | window = hannWindow |
||
) |
Performs fourier resampling using fourier transform and the provided window function.
in | Input image |
spacing | Desired output spacing |
window | Window function to reduce ringing |
ptr<MRImage> npl::resampleNN | ( | ptr< const MRImage > | in, |
ptr< const MRImage > | atlas, | ||
PixelT | type = UNKNOWN_TYPE |
||
) |
Performs nearest neighbor resasmpling of input to atlas.
in | Input image |
atlas | |
type | of output pixel (defaults to input type) |
ptr<MRImage> npl::resampleNN | ( | ptr< const MRImage > | in, |
double * | newspace, | ||
PixelT | type = UNKNOWN_TYPE |
||
) |
Performs nearest neighbor resasmpling of input to atlas.
in | Input image |
newspace | new spacing |
type | pixel type of output (defaults to input) |
ptr<MRImage> npl::rigidTransform | ( | ptr< MRImage > | in, |
double | rx, | ||
double | ry, | ||
double | rz, | ||
double | sx, | ||
double | sy, | ||
double | sz | ||
) |
Rigid Transforms an image.
in | Input/output image |
rx | Rotation about x axis |
ry | Rotation about y axis |
rz | Rotation about z axis |
sx | shift about x axis |
sy | shift about y axis |
sz | shift about z axis |
int npl::rotateImageShearFFT | ( | ptr< MRImage > | inout, |
double | rx, | ||
double | ry, | ||
double | rz, | ||
double(*)(double, double) | window = npl::sincWindow |
||
) |
Rotates an image around the center using shear decomposition followed by FFT-based shearing. Rotation order is Rz, Ry, Rx, and about the center of the image.
inout | Input/output image |
rx | Rotation about x axis |
ry | Rotation about y axis |
rz | Rotation about z axis |
rz | Rotation about z axis |
window | Window function to apply in fourier domain |
int npl::rotateImageShearKern | ( | ptr< MRImage > | inout, |
double | rx, | ||
double | ry, | ||
double | rz, | ||
double(*)(double, double) | kern = npl::lanczosKern |
||
) |
Rotates an image around the center using shear decomposition followed by kernel-based shearing. Rotation order is Rz, Ry, Rx, and about the center of the image. This means that 1D interpolation will be used.
inout | Input/output image |
rx | Rotation about x axis |
ry | Rotation about y axis |
rz | Rotation about z axis |
kern | Kernel to use for interplation |
Uses fourier shift theorem to shift an image.
in | Input image to shift |
len | length of dx array |
vect | movement in physical coordinates, will be rotated using image orientation prior to shifting |
Performs smoothing in each dimension, then downsamples so that pixel spacing is roughly equal to FWHM.
in | Input image |
sigma | Standard deviation for smoothing |
spacing | Ouptut image spacing (isotropic). If this is <= 0, then sigma will be used, which is a very conservative downsampling. |
Writes a pair of images, one real, one imaginary or if absPhase is set to true then an absolute image and a phase image.
basename | Base filename _abs.nii.gz and _phase.nii.gz or _re.nii.gz and _im.nii.gz will be appended, depending on absPhase |
in | Input image |
absPhase | Whether the break up into absolute and phase rather than re/imaginary |