File Exchange

image thumbnail

Shape Context Based Corresponding Point Models

version 1.1.0.0 (18.5 MB) by Dirk-Jan Kroon
Shape Context based nonrigid registration of 2D/3D objects, to build Active Shape Models

9 Downloads

Updated 26 Jan 2012

View License

Shape Context is a method to get an unique descriptor (feature vector) for every point of an object contour or surface. This descriptor is used in combination with a b-spline free form deformation grid, for fully automatic creation of point mappings between surfaces of patient datasets (2D/3D).

The 2D Example will create a corresponding point model (PCM) for a set of 10 2D hand contours.

The 3D Example will create a PCM for a set of 10 3D jaw triangulated surfaces.

There are also examples using the PCM's to train and use 2D/3D Active Shape Models (ASM) and Active Appearance Models (AAM). (folder "ActiveModels_version7")

The 2D example takes a couple of minutes. The 3D-example about 7 hours, and requires 64bit Matlab.

The non-rigid mapping between datasets is kept Diffeomorphic to prevent mesh folding. But the optimizer doesn't succeeded in all cases of the 3D-example (maybe in next update)

Notes:
- The examples, will compile some c-coded functions into MEX files. In case of failure slower Matlab coded functions will be used.
- Most functions in this zip-archive are also available as standalone files on the File-Exchange, and can be newer/updated.

Cite As

Dirk-Jan Kroon (2020). Shape Context Based Corresponding Point Models (https://www.mathworks.com/matlabcentral/fileexchange/30845-shape-context-based-corresponding-point-models), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (25)

Alan Lund

In getHistogramFeatures.m, is there a reason that R values are not constrained to be less than or equal to the maximum allowed r value, like this?
R(R>options.r_max)=options.r_max;
The corresponding constraint for the minimum is applied. Without applying the max constraint, R values can overflow, either moving points from high R bins into low R bins (for larger angles), or in the worst case, overflowing the histogram array when a point would otherwise be in the maximum A, W and R bins.

Jacob Nye

Great package overall. On MATLAB 2019b, for the 3D examples, one change that had to be made to prevent breaking errors caused by a change in mex-code generation was that the lines with mex code generation had to be changed from looking like the following

mex('interp3fast_double.c','image_interpolation.c');

to

mex -compatibleArrayDims 'interp3fast_double.c' 'image_interpolation.c';

since otherwise the dimensions came out wrong and were ridiculously large (causing errors saying that MATLAB would require petabytes of RAM/memory to hold a matrix of the dimensions it was trying to compute). The general pattern for fixing this error that allowed the code to run was removing the parentheses from the lines that began with mex, followed by adding a space and a -compatibleArrayDims before the first filename with a .c. This also included making these changes in the MATLAB scripts compile_c_files.m within several folders of this package.

@slshhr the article this is based on is the thesis at the following link: https://research.utwente.nl/en/publications/segmentation-of-the-mandibular-canal-in-cone-beam-ct-data

slshhr

Please,What is the article on this basis?

zhe liu

Xin Shu

Please, how i can create my manual landmark ?

nesrine

I have a CT-scan volume of liver and i want to generate the "land.mat" how i can get my "land.mat" fromy 3D data ? thank you a lot

For anyone looking to use these files, I've had to install a couple of toolboxes to get them working. Here is a list of the toolboxes I've installed.

Image Processing Toolbox
Statistics and Machine Learning Toolbox
System Identification Toolbox
Control System Toolbox
Signal Processing Toolbox

How can I get(define) the final measured by similarity (or sorted by similarity) value.

Hello. I performed image to image registration with your jaw data. But i would like to work with my own scapula data which i have as point cloud and not a volume, in stl or ply format. For the faces and vertices i can get these data and for the two different scales. But i don't have I1 volume available. Do you have a solution ? I'd like to try your algorithm because the scapula is a thin bone just like the jaw.

Thank you.

When running the 2D example of ActiveModels_version7, I get an error message:

Undefined function or variable 'interp'.

Error in LoadDataSetNiceContour (line 21)
pointsx=interp(p.x,r); pointsx=pointsx(1:end-r+1);

Error in ASM_2D_example (line 60)
[Vertices,Lines]=LoadDataSetNiceContour(filename,options.ni,options.verbose);

Could it be that the function "interp" doesn't exist in Matlab 2015?

Instead, I tried to use the results of the asm example of creating the training set, but failed.

I hope you can help me solve this problem. I would like to use this example in my lecture on active shape models.

Silvia

*Wong
Please, look for the references in:
http://www.k-zone.nl/Kroon_Thesis_small.pdf

WONG

hello.can you tell me the original paper you referred to when writing the programs"Shape Context Based Corresponding Point Models".

Mark Sena

Trying to run on OSX 10.7.5, but getting the error:
/Applications/MATLAB_R2012a_Student.app/bin/mex: line 305: gcc-4.2: command not found
-> gcc-4.2 -c -I/Applications/MATLAB_R2012a_Student.app/extern/include -I/Applications/MATLAB_R2012a_Student.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.5 -fexceptions -DMX_COMPAT_32 -O2 -DNDEBUG "Features2CostMatrix.c"

/Applications/MATLAB_R2012a_Student.app/bin/mex: line 1326: gcc-4.2: command not found

mex: compile of ' "Features2CostMatrix.c"' failed.

Any help is appreciated.
Can't wait to use it!

Xiangqi

Xiangqi

Thank you for providing the code.

I am trying to use the ShapeContext function. It seems that the demo data "testdata.mat" in the folder "ShapeContext_version2" doesn't contain the correct data.

*Birgit
Knnsearch is part of the "Statistics Toolbox" of Matlab. Maybe you can find a similar but free implementation on the File Exchange

Birgit

When I run BuildingModels\Example3D the function createns(), knnsearch() and maybe others called by Horn_Align_ICP are missing. Could the deliver be incomplete?

Birgit

Li Cheng

I found MATLAB code for active contours model in 1998 for a long time. Then found it. Really a good job!

l.l.

Hi! I don't understand how to set landmarks on my 3D dataset. I have to manually fix them on each image?
Thanks in advance and I apologize if the claim proves foolish.
L.

M M

how long should the 2D example take to run?

wang

why I can not download it?

A master piece ...

Updates

1.1.0.0

Many bugs solved. Less memory usage.

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

ActiveModels_version7/

ActiveModels_version7/AAM Functions/

ActiveModels_version7/ASM Functions/

ActiveModels_version7/Functions/

ActiveModels_version7/InterpFast_version1/

ActiveModels_version7/PatchNormals_version1/

ActiveModels_version7/PieceWiseLinearWarp_version2/

ActiveModels_version7/PieceWiseLinearWarp_version2/functions/

ActiveModels_version7/polygon2voxel_version1j/

BuildingModels/

BuildingModels/DistanceFieldCP_version1/

BuildingModels/DistanceFieldCP_version1/functions/

BuildingModels/DistanceFieldCP_version1/polygon2voxel_version1j/

BuildingModels/ShapeContext_version2/

BuildingModels/ShapeContext_version2/functions/

BuildingModels/functions/

BuildingModels/isocontour_version2/

BuildingModels/nonrigid_version25/

BuildingModels/nonrigid_version25/functions/

BuildingModels/nonrigid_version25/functions_affine/

BuildingModels/nonrigid_version25/functions_nonrigid/

BuildingModels/nonrigid_version25/low_level_examples/

BuildingModels/polygon2voxel_version1j/