Kevin Mader, Maria Büchner
27 March 2014
ETHZ: 227-0966-00L
Basic Exercises
Advanced Exercises
Once you have logged in
In Matlab run the following code Copy / Paste from Here
cd('~')
unzip('http://jenkins.imagej.net/job/Stable-Fiji/lastSuccessfulBuild/artifact/fiji-nojre.zip','./')
addpath 'Fiji.app/scripts'
Miji % start Miji
cd('~')
% to test if it works
% Miji_Test
If the Java Heap Space is not high enough strange error messages may appear. Increase the Java Heap Space using the preferences (in this movie)
Pushing Matlab Images to ImageJ
% random 500 x 500 array
imData=rand(500);
MIJ.createImage('test',imData,true);
Reading Images from FIJI to Matlab
MIJ.run('Embryos (42K)');
imData = MIJ.getCurrentImage;
% take the sum of red, green, and blue
imSum = sum(double(imData(:,:,1)),3);
subplot(1,2,1)
imagesc(imSum);
subplot(1,2,2);
imagesc(imSum<150)
For many commands, the results from macro recording can be directly used in Matlab/MIJI by making the following changes
MIJ.
before the commandrun("Compute Curvatures", "compute sigma=0.5000 use order");
\[ \downarrow \textrm{Becomes} \]
MIJ.run('Compute Curvatures', 'compute sigma=0.5000 use order');
Many of these operations can produce fairly complicated results which can be difficult to interpret on complex structures. It is thus easiest to test their functionality and parameter sensitivity using test images.
setBackgroundColor(0,0,0)
newImage("Untitled", "8-bit white", 2000, 2000, 1);
run("Invert");
makeOval(252, 177, 240, 240);
setBackgroundColor(0, 0, 0);
run("Invert");
makeOval(840, 180, 222, 501);
run("Invert");
makeOval(1494, 168, 222, 879);
run("Invert");
makeOval(255, 1308, 633, 633);
run("Invert");
makeOval(1236, 1191, 642, 741);
run("Invert");
run("Select None");
Two options
run("Geometry to Distance Map", "threshold=1");
run("Distance Map to Distance Ridge");
ImageJ Macro or make your own
FIJI has a built in pathway for performing thickness analysis in the
This can be used from Matlab with the following command
MIJ.run('Local Thickness (complete process)', 'threshold=1')
http://people.ee.ethz.ch/~maderk/qbi/PivoData.zip
We will use watershed segmentation to “break apart” single blobs into sub-objects
MIJ.run('Watershed')
Using the foam images from the thickness component
MIJ.run('Compute Curvatures', 'compute sigma=0.5000 use order');
Compute the curvature on several test images and try adjusting the sigma (\( \sigma \)) value for the Gaussian filter applied.
Using one of the test images you have made (or the one we supplied by Macros). You can show the curvature distribution against the shape and get a feeling for the kind of results you can extract
Using the follwing script you can inspect the results.
This version calculates just the positive curvatures by using absolute value
Can you differentiate between small circles and large circles (create an image to test this)
What is the relationship between radius and curvature?
In an anisotropic ellipse how to the semiaxis lengths relate to the curvature?
http://people.ee.ethz.ch/~maderk/qbi/PivoData.zip
Video Instructions Additional more detailed Web Instructions
The following python script / Paraview state file (they perform the same task but one is more of a macro while the other is a saved state file) show how to use the “Threshold” and “Extract Surface” commands to get meshes from voxel data. For curvature we will use the contour command (like isosurface in Matlab) to extract contours at different values. From these contours we can then calculate the curvature using the curvature filter
We can visualize the results either in 3D mapped to the surface or as a histogram by using the Histogram tool
Matlab's built-in watershed function works on both 2- and 3D image data.
watershed
The Matlab watershed command performs both watershed and the labeling of the resulting components (as shown in the lecture) unlike FIJI which just introduces a line between components that could be separated so that component labeling can be performed.
nlfilter
command with a special function to identify if more than one voxel type is presentunique
command tells you the different values present in a list