Download MATITK |
Usage GuideTo use the wrapper, MATLAB must be able to locate the matitk.dll*. This usually means the current working directory of MATLAB should be set to the location of matitk.dll. Copy matitk.dll to the desired location, launch MATLAB and set search path of MATLAB or change current directory to the location of the DLL.
For help information, type matitk('?') in MATLAB’s command window. To list out the filtering, segmentation and registration methods implemented in MATITK, type matitk('f'), matitk('s') and matitk('r')** respectively. The opcodes listed are used to invoke the MATITK method. *This assumes MATITK is being run on Windows platform. This can be .so file when MATITK is being run on Linux machines.
In MATLAB, calls to MATITK methods would generally take the following format:
matitk(operationName,[parameters],[inputArray1],[inputArray2],[seed(s)Array],[Image(s)Spacing]) Legend:
Example
To demonstrate the functionality of MATITK, we first load the sample built-in 3D brain mri image from MATLAB. The loaded image will automatically be stored inside the variable D.
>> load mri; >> D=squeeze(D);
We can use the following commands to visualize an axial brain slice (Figure 1): subplot(131);imagesc(squeeze(D(:,:,round(end/2))));axis image; colormap gray subplot(132);imagesc(squeeze(D(:,round(end/2),:)));colormap gray subplot(133);imagesc(squeeze(D(round(end/2),:,:)));colormap gray set(gcf,'position',[364 628 743 320]) Figure 1 : (Left to right) Visualizing an axial, sagittal, and coronal brain slice of the sample image D.
The data type of the loaded image is unsigned char. As such, we would like to use the double data type version of MATITK, and we first convert the input using double(D). matitk(‘f’) is invoked to show the list of implemented filtering methods and the corresponding opcode.
FCA is the opcode for CurvatureAnisotropicDiffusionImageFilter The data type of the loaded image is unsigned char. As such, we would like to use the double data type version of MATITK, and we first convert the input using double(D). matitk(‘f’) is invoked to show the list of implemented filtering methods and the corresponding opcode.
FCA is the opcode for CurvatureAnisotropicDiffusionImageFilter. matitk(‘fca’) can be used to list out the arguments required for using CurvatureAnisotropicDiffusionImageFilter (i.e. numberOfIterations, timeStep and conductance). For the example, we chose our arguments to be 5, 0.0625 and 3 respectively in this order, and supply the arguments as an array:
We can use the following commands to visualize the filtering result (Figure 2): imagesc(squeeze(b(:,:,15)));
Figure 2 : Visualizing sample image D after “FCA” operation. The operation is performed in double data-type mode. We apply ConfidenceConnectedImageFilter to the resulting filtered image (Figure 3). The following example illustrates how the seed point (102, 82, 25) is supplied as an argument:
>> c= matitk('SCC',[1.4 10 255],double(b),double([]),[102 82 25]); Image input of type double detected, executing MATITK in double mode
SCC is being executed... SCC has completed.
Figure 3 : Visualizing sample image D after “FCA” and “SCC” operation.
Instead of invoking the “double” version of ConfidenceConnectedImageFilter, we could first cast b into unsigned char first. The unsigned char version of ConfidenceConnectedImageFilter will be invoked as a result (Figure 4):
>> c=matitk('SCC',[1.4 10 255],uint8(b),uint8([]),[102 82 25]); Image input of type unsigned char detected, executing MATITK in unsigned char mode
SCC is being executed... SCC has completed.
Figure 4 : Visualizing sample image D after “FCA” and “SCC” operation. The operations are performed in unsigned char data-type mode.
Notice how casting can affect the final result.
For another illustration, we apply GradientMagnitudeImageFilter to the original image D of type unsigned char (Figure 5). Notice the unsigned char version of ITK method will be used:
Figure 5 : Visualizing sample image D after “FGM” operation. (Left to right) Axial, sagittal, and coronal brain slices.
MATITK also supports receiving multiple outputs from ITK methods. The resulting images of invoking OtsuMultipleThresholdImageFilter will be stored in variables O1, O2, and O3 (Figure 6):
[O1,O2,O3]=matitk ('fomt',[3,128],D); Image input of type unsigned char detected, executing MATITK in unsigned char mode
fomt is being executed... fomt has completed.
Figure 6 : Visualizing the three outputs of “FOMT” operation. Figure 7 : A slice of the cube before (left) and after (right) applying Thin Plate Spline Warping (“RTPS”) operation.
To illustrate how warping can be applied using MATITK, consider warping a cube according to the following landmarks:
The source landmarks correspond to the edges of the cube, and the target landmarks correspond to randomly generated points close to the original edges.
A=zeros(30,30,30); A(10:20,10:20,10:20)=1; output=matitk ('rtps',[],A,A,[10 10 10 12 12 13 10 10 20 11 13 22 10 20 10 12 23 11 10 20 20 12 21 21 20 10 10 20 11 12 20 10 20 22 10 23 20 20 10 20 21 11 20 20 20 20 23 21]); Image input of type double detected, executing MATITK in double mode
rtps is being executed... rtps has completed.
The result of execution is shown in (Figure 7).
Available OpcodesAs of version 2.4.04 released on Aug 24 2006, the following table lists the operations are available.
The following segmentation functions are implemented:
The following registration functions are implemented:
For documentation on each method, simply types its corresponding opcode in MATITK prompt.
e.g. matitk ('rtps') would give:
rtps is being executed...
***********Begin description of registerThinPlateSpline(rtps)***********
ThinPlateSplineKernelTransform This class defines the thin plate spline (TPS) transformation. It is implemented in as straightforward a manner as possible from the IEEE TMI paper by Davis, Khotanzad, Flamig, and Harms, Vol. 16 No. 3 June 1997
Transforms ***************************End description***************************
You must supply parameters for this function in an array, with the elements in this order:
0 parameters must be supplied. You supplied 0. ??? Correct number of parameters must be supplied. At least one image volume has to be supplied.
|