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
library(tiff) | |
library(gdata) | |
# path paste | |
pa.paste<-function(...) paste(...,sep="/") | |
get.last<-function(in.list,offset=0) in.list[length(in.list)-offset] | |
pa.getlast<-function(in.path,offset=0) get.last(strsplit(in.path,"/")[[1]],offset=offset) | |
get.or.blank<-function(var,altval="") { | |
if(is.null(var)) altval | |
else var | |
} |
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
library(SparkR,lib.loc="/home/mader/tools/SparkR-pkg/lib") | |
sc<-sparkR.init(master="local[40]") | |
cfile<-textFile(sc,"/home/mader/work/simple.csv") | |
testinput<-take(cfile,3) | |
headertext<-strsplit(testinput[[1]],",")[[1]] | |
sample.col<-which(headertext %in% "file.name") | |
format.row<-function(in.row) { | |
in.txt<-strsplit(in.row,",")[[1]] | |
list(in.txt[sample.col],mapply(list,headertext[-sample.col],sapply(in.txt[-sample.col],as.double))[2,]) | |
} |
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
image = WindowManager.getCurrentImage() | |
stack = image.getStack() # get the stack within the ImagePlus | |
n_slices = stack.getSize() # get the number of slices | |
# iterate over every slice | |
for sliceIndex in range(1,n_slices+1): | |
curSlice=stack.getProcessor(sliceIndex) | |
sumVal=0;countPixel=0 | |
# iterate over every pixel in the slice | |
for cPixel in curSlice.toFloatArrays()[0]: | |
sumVal+=cPixel |
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
import ij.*; | |
import ij.process.*; | |
import ij.gui.*; | |
import java.awt.*; | |
import ij.plugin.*; | |
import ij.plugin.frame.*; | |
public class AverageSliceValue implements PlugIn { | |
public void run(String arg) { |
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
% 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('~') |
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
% start Fiji interface | |
cur_dir=pwd; | |
Miji | |
% for some reason the miji script changes directory so this changes it back | |
cd(cur_dir); | |
% create the simulated image | |
[outImage,out_pos,out_shape,out_theta] = cell_simulator(100,10,3,0,1); | |
% send the image to FIJI | |
MIJ.createImage('test',outImage,true); | |
% set a threshold (yes the programmer spelled it incorrectly) |
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
% this function (will) performs the ellipsoid based shape analysis on a 3D image | |
% the input is a labeled image probably from the bwlabel function | |
% the output is an array formatted like such | |
% labelId, volume, centerX, centerY, centerZ, extentsX, extentsY, extentsZ, pca1X, pca1Y, pca1Z, score1, score2, score3 | |
function [out_table]=ellipse_analysis(in_image) | |
% create an array the same size as the image of x,y, and z points. This way we can calculate | |
% center of volume and other parameters by using multiplication | |
[xgrid,ygrid,zgrid]=meshgrid(1:size(in_image,1),1:size(in_image,2),1:size(in_image,3)); | |
num_of_obj=max(in_image(:)); |
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
% 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=[1,200,400]; | |
yv=xv; |
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
<ParaView> | |
<ServerManagerState version="4.1.0"> | |
<Proxy group="animation" type="AnimationScene" id="263" servers="16"> | |
<Property name="AnimationTime" id="263.AnimationTime" number_of_elements="1"> | |
<Element index="0" value="0"/> | |
</Property> | |
<Property name="Caching" id="263.Caching" number_of_elements="1"> | |
<Element index="0" value="0"/> | |
<Domain name="bool" id="263.Caching.bool"/> | |
</Property> |
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
% Read the starting image into Matlab | |
bwData=MIJ.getCurrentImage > 0; | |
%% setup and run curvature | |
% calculate the labels | |
labelImage=bwlabel(bwData); | |
% Calculate the Curvatures | |
MIJ.run('Compute Curvatures','compute sigma=2 use order') | |
% Read the output image into Matlab as a Stack | |
curvData=MIJ.getCurrentImage; |
OlderNewer