Kevin Mader (mader@biomed.ee.ethz.ch)
13 March 2014
Once you have logged in
Open Matlab
Type in the following commands exactly!
This will start Fiji
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)
Download the function and save it in your home directory image_generator.m to generate images with varying number of cells(5-1000) illumination (0.5-2) and noise (0-2)
As the cell count gets higher the intensity histogram may show multiple peaks, what does this mean?
Perform component labeling on the image and count the number of components (hint: the same as the maximum label in the image, \( max(imData(:)) \))
Use FIJI to perform the other automatic threshold techniques (try them all) on the images and discuss which works best for
Finally use the 3D object counter and compare the number of cells found with the number Matlab found and the number you put in for the same image.
curCellIm=image_generator(100,0,255);
MIJ.createImage('testCellImage1',curCellIm,true);
We start with the color image of embryos but instead of summing all channels we keep them to use in K-Means analysis. The following code runs k-means on the image for 3 groups.
MIJ.run('Embryos (42K)');
imData = double(MIJ.getCurrentImage);
% raster scan image to 3 , 1D arrays
imList=reshape(imData,[],3);
%peform k-means
[groupList,centers]=kmeans(imList,3);
% reshape into an image
groupIm=reshape(groupList,size(imData,1),size(imData,2));
imagesc(groupIm);
Modify the code so it works with 5 groups, does this make sense?
Modify the code so the red channel (:,:,1) is valued twice as much as the other (green and blue channels)
Modify the code so each channel is normalized to its own variance.
Which produces the best results?
% load the sample image
MIJ.run('Confocal Series (2.2MB)');
stackImage = double(MIJ.getCurrentImage);
% show a slice
imagesc(stackImage(:,:,25));pause(2);
% show a histogram of the image
hist(stackImage(stackImage>0));pause(2);
% create slices
xv=yv=[1,200,400];
zv=[1,25,50];
slice(stackImage,xv,yv,zv);
% create isosurface
isosurface(stackImage,100);pause(2);
A free tool called MeVisLab offers LiveWire 3D contouring tools which work similar to the Photoshop version with much more flexibility. A tool and sample contour has been provided by David Haberthuer from PSI demonstrating and visualizing this contouring on a human brain image. A video is available here