-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding some examples and cleaning up the code as well as switching to…
… md format for the readmes
- Loading branch information
1 parent
1956208
commit 5e6533a
Showing
42 changed files
with
2,527 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
DeformIt - Tool for simulating ground truth labels and transformations via physical and statistical warps. | ||
========================================================================================================== | ||
Preet S. Jassi, May 5 2011 | ||
-------------------------- | ||
|
||
DeformIt is a Matlab tool to generate a large data-set deformed images and ground truth segmentations for machine learning algorithms based on a single prototype image and ground truth segmentation. To deform 2D images, use 2D/DeformIt.m. To deform 3D images use 3D/DeformIt.m | ||
|
||
To generate a large data-set of 2D images based on a single image and segmentation, run the following command in Matlab: | ||
|
||
```Matlab | ||
DeformIt(file, segmentation, nObs, WarpedImage, cp, RandomMorph, RandomRange, alpha1, t, Noise, NoiseType, NM,NV,ND,NonUniform, ncp, NonUniformStrength) | ||
``` | ||
|
||
where: | ||
|
||
* _file_ - the filename | ||
* _segmentation_ - the segmentation name or empty string | ||
* _nObs_ - the number of images you want to generate | ||
* _WarpedImage_ - 1 if the image is to be deformed and 0 if the image is not to be deformed (warped) | ||
* _cp_ - the number of control points per axis of the image if you do not want to manually specify the control points | ||
* _RandomMorph_ - 1 if you want the deformation to be Random instead of Vibrational / Variational | ||
* _RandomRange_ - integer between [0,1] for the range of the random vectors where 1 is half the distance between control points | ||
* _alpha1_ - weight of vibrational vs variational when calculating the displacement vectors in the range [0,1] | ||
* _t_ - number of variational modes used in describing the deformation or the fractional variance if less than one, value between [0, nObs^2] | ||
* _Noise_ - 1 if you want to add noise to the image | ||
* _NoiseType_ - gaussian, poisson, salt & pepper, speckle | ||
* _NM_ - the mean of the noise for guassian noise | ||
* _NV_ - the variance for guassian and speckle | ||
* _ND_ - density for salt and pepper | ||
* _NonUniform_ - 1 if you want non uniformity intensities added to simulate the imhomogenity found in magentic resonance images | ||
* _ncp_ - the number of control points for the non uniformity | ||
* _NonUniformStrength_ - the strength of the non uniformity [0,1] | ||
|
||
You can also specify landmarks in a text file landmarks.txt and the new location of those landmarks will be specified. | ||
|
||
Generating deformed 3D images is very similar. Look at DeformIt.m in the 3D folder for information about the parameters. | ||
|
||
You can read the paper here for more information about [DeformIt](http://www.erudianart.com/research/papers/deformit.pdf) | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% @file 2d.m | ||
% @author Preet S. Jassi | ||
% @date August 15th 2011 | ||
% @description Example 2d deformation | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
|
||
% set the parameters for DeformIt to be used | ||
% detailed description of the parameters and their ranges is in the | ||
% DeformIt.m file in the /src/2d/ directory | ||
% NOTE: this file needs to be copied into the source directory to work | ||
|
||
file = 'O1451U10X.tif'; | ||
segmentation = 'O1451U10X_12042006.tif'; | ||
nObs = '20'; | ||
WarpedImage = '1'; | ||
cp = '6'; | ||
RandomMorph = '0'; | ||
RandomRange = '0'; | ||
alpha1 = '0.5'; | ||
t = '0.8'; | ||
Noise = '1'; | ||
NoiseType = 'gaussian'; | ||
NM = '0'; | ||
NV = '0.01'; | ||
ND = '0'; | ||
NonUniform = '1'; | ||
ncp = '6'; | ||
NonUniformStrength = '0.5'; | ||
|
||
% deform the image and the ground thruth segmentation | ||
% note that these files need to be copied into the source folder in order for it to work | ||
DeformIt(file, segmentation, nObs, WarpedImage, cp, RandomMorph, RandomRange, alpha1, t, Noise, NoiseType, NM,NV,ND,NonUniform, ncp, NonUniformStrength); |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% @file 3d.m | ||
% @author Preet S. Jassi | ||
% @date August 15th 2011 | ||
% @description an example 3d image deformation | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
% set the parameters for DeformIt to be used | ||
% detailed description of the parameters and their ranges is in the | ||
% DeformIt.m file in the /src/3d/ directory | ||
% NOTE: this file needs to be copied into the source directory to work | ||
|
||
filetype = 'analyze'; | ||
file = 'analyze'; | ||
segmentation = '0'; | ||
nObs = '10'; | ||
WarpedImage = '1'; | ||
cp = '6'; | ||
RandomMorph = '1'; | ||
RandomRange = '0.5'; | ||
alpha1 = '0'; | ||
t = '0'; | ||
Ansio = '1'; | ||
Noise = '1'; | ||
NonUniform = '1'; | ||
ncp = '6'; | ||
NonUniformStrength = '0.5'; | ||
|
||
% deform the image and the ground thruth segmentation | ||
% note that these files need to be copied into the source folder in order for it to work | ||
DeformIt(filetype, file, segmentation, nObs, WarpedImage, cp, RandomMorph, RandomRange, alpha1, t, Ansio, Noise, NonUniform, ncp, NonUniformStrength); |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DeformIt Examples | ||
================= | ||
|
||
To execute the examples, first copy over the example code to the respective source directory (/src/2d/ or /src/3d/) and then execute 2d.m or 3d.m in Matlab in the /src/2d/ or /src/3d/ directories. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% @file GenerateDeformedAndSegmentedImages.m | ||
% @author Preet S. Jassi (sorta...) | ||
% @date July, 31th 2008 | ||
% @returns interpolated image | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
function [DeformedIm, X, Y] = DeformImage(Im,Frx,Fry,Tox,Toy,type) | ||
% [x y x y x y x y x y] | ||
[XX,YY] = meshgrid(1:size(Im,2), 1:size(Im,1)); | ||
|
||
if (Frx == Tox' & Fry == Toy') | ||
DeformedIm = Im; | ||
X = XX; | ||
Y = YY; | ||
return | ||
end | ||
|
||
|
||
Rows = Frx; | ||
Columns = Fry; | ||
XDeformations = Tox; | ||
YDeformations = Toy; | ||
|
||
% Fit spline for the X Deformation | ||
X = FitSpline(XX, Rows, Columns, XDeformations); | ||
|
||
% Fit spline for the Y Deformation | ||
Y = FitSpline(YY, Rows, Columns, YDeformations); | ||
|
||
%noise types | ||
|
||
|
||
|
||
|
||
% Resample Image. | ||
DeformedIm = InterpolateImage2(X, Y, Im, type, XX, YY); | ||
% return |
Oops, something went wrong.