Skip to content

Instantly share code, notes, and snippets.

@kmader
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmader/9503137 to your computer and use it in GitHub Desktop.
Save kmader/9503137 to your computer and use it in GitHub Desktop.
Exercise 4 Setup and K-Means Code
% change to your home directory
cd('~')
% download and extract the latest version of fiji
unzip('http://jenkins.imagej.net/job/Stable-Fiji/lastSuccessfulBuild/artifact/fiji-nojre.zip','./')
% add the Fiji scripts folder to the matlab path
addpath 'Fiji.app/scripts'
% start Miji
Miji
% for some reason Miji changes to directory so go back to the home directory
cd('~')
% to test if it works
% Miji_Test
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));
% show the result
imagesc(groupIm);
@kmader
Copy link
Author

kmader commented Mar 12, 2014

curl does not work on these matlab versions because of library issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment