Advertisement
operian

ImageJ: quantify colocalization by point selection

Dec 5th, 2022 (edited)
957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.17 KB | Science | 0 0
  1. //to import code in ImageJ: File>New>New text window>paste the following:
  2.  
  3. input = "C:/Users/Zsofi/Desktop/test2/"; //change imput dir as required
  4. output = "C:/Users/Zsofi/Desktop/test2/"; //change output dir as required
  5.  
  6. path = getDirectory("image");
  7. list=getFileList("C:/Users/Zsofi/Desktop/test2/"); //change imput dir as required
  8.  
  9. for (i = 0; i < list.length; i++){
  10.         action(input, output, list[i]);
  11. }
  12.  
  13. function action(input, output, filename) {
  14.         open(input + filename);
  15.         img_title = getTitle();
  16.  
  17. run("Split Channels");
  18. selectWindow(img_title+" (blue)");
  19. close(); //closes DAPI/blue channel
  20. selectWindow(img_title+" (red)");
  21. run("Find Maxima...", "prominence=100 output=[Point Selection]");  //change prominance val. based on manual checking
  22. run("Enlarge...", "enlarge=12"); //change enlarge based on ROI size
  23. selectWindow(img_title+" (green)");
  24. run("Restore Selection");
  25. run("ROI Manager...");
  26. roiManager("Add");
  27. roiManager("Split");
  28. roiManager("Measure"); //gives you a brightness value in the green channel for every red dot
  29. roiManager("Delete");
  30. selectWindow(img_title+" (red)");
  31. close();
  32. selectWindow(img_title+" (green)");
  33. close();
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement