Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Bloc de code
languagejava
titleMacro Measure Images overall parametersImageJ Collect Global measurements
collapsetrue
 

//It might be easier to process images from a folder
//You would need to customize this path to your computer
InputDir="/Users/nicolas/Desktop/Input/";

// You could also get a prompt to select the InputDir
// InputDir = getDirectory("Choose a Directory ");


// And to save results in an output folder
// You would need to customize this path to your computer
//OutputPath="/Users/nicolas/Desktop/Output/";

//You could also create a new folder based on the name of the input folder
ParentPath=File.getParent(InputDir); 
InputDirName=File.getName(InputDir);
OutputDir=ParentPath+File.separator+InputDirName+"_Results";
i=1;

while(File.exists(OutputDir)){
OutputDir=ParentPath+File.separator+InputDirName+"_Results"+"-"+i;
i++;
}
File.makeDirectory(OutputDir);
OutputPath=OutputDir+File.separator;


//Then you can measure all values for all ch and all images

ListFile=getFileList(InputDir); 
run("Set Measurements...", "area mean standard modal min centroid center perimeter bounding fit shape feret's integrated median skewness kurtosis area_fraction stack display redirect=None decimal=3");
run("Clear Results");

// It might be faster to work in batchmdoe
setBatchMode(true);


for (Filei=0; Filei<ListFile.length; Filei++){
FilePath=InputDir+ListFile[Filei];
open(FilePath);
ImageName=getTitle();
selectWindow(ImageName);
run("Select None");
run("Measure Stack...");
selectWindow(ImageName); run("Close");
}
selectWindow("Results");
saveAs("Text", OutputPath+"Overall_Measurements.csv");
selectWindow("Results"); run("Close");
   

...

If all works fine you should have a csv CSV file you can open with your favourite spreadsheet applications. This table should give one line per image and all available measurements for the whole image and for each channel of the image. Of course some measurements will be all the same because the images were taken in the same way.

What to do with the file? Explore the data and see if there is any relelvant infroamtion.

My view would be to use a short script in R to plot all the data and to some basic statistics


Bloc de code
languageruby
titleR Plot ImageJ Global Measurements
collapsetrue
# Prompt for the input CSV file from ImageJ measurements
Input<-file.choose()

# You must cange this path to match your computer
Output<-"/Users/nicolas/Desktop/Output/"
#Output <- "C:\\Users\\stifanin\\OneDrive - Universite de Montreal\\Bureau\\Output\\"


data<-read.csv(Input)

require("ggpubr")

List<-strsplit(as.character(data$Label), ':')

#Add Filename and Group to the data
data$Filename<-as.factor(sapply(List, "[[", 1))
Group<-strsplit(as.character(data$Filename), '_')
data$Group<-as.factor(sapply(Group, "[[", 1))
# MAke Ch as a factor
data$Ch<-as.factor(data$Ch)

#Create a list of plots
ListofPlots<-list()
i=1;

for(ColI in 3:(ncol(data)-2)){
  if(!is.factor(data[[ColI]])){
    for (ChI in 1:nlevels(data$Ch)){
   Graph<-   ggboxplot(
        data[data$Ch==ChI,], x = "Group", y = colnames(data[ColI]),
        color = "Group", palette = c("#4194fa", "#db51d4"),
        add = "jitter", title=paste0(colnames(data[ColI])," of Channel ", ChI)
      )+stat_compare_means(method = "t.test")
   ListofPlots[[i]]<-Graph
i=i+1
  }
  }
}

#Export the graphs
ggexport(
  plotlist = ListofPlots, filename = paste0(Output,"Graphs.pdf"), 
  ncol = 2, nrow = 2, verbose=TRUE, res=600
)