////////////////////////////////////////////////////////////////////// // // // PASCAL! // // Perineuronal net Automation Software for // // Computation and Analysis of Labeling // // // // Written by John H. Harkness, Ph.D. // // >>> Contact: harknessjh@gmail.com // // >>> Copyright (C) 2016, John H. Harkness // // // // Washington State University, Vancouver // // // // Supported by: // // >>> WSU Alcohol and Drug Abuse Research Program (ADARP) // // >>> The Translational Addiction Research Center (TARC) // // >>> NIH DA 033404 // // >>> Washington State Initiative Measure No. 171 // // // // Protocol based on Slaker, Harkness, and Sorg, 2016 // // >>> Special thanks to Megan Slaker // // // // >>> PLEASE CITE: Slaker, et al., 2016 (IN SUBMISSION) <<< // // // ////////////////////////////////////////////////////////////////////// //Global variables var lower=0; var import_type=0; var first_open = 0; var last_open = 0; var name = 0; var full_name = 0; var dir = 0; var first_time = 0; var save_location = 0; var countCount = 0; /////////////////////////// macro "PASCAL" { Dialog.create("Welcome."); items = newArray("Count labeled cells.", "Single label intensity analysis."); Dialog.addRadioButtonGroup("What would you like to do?", items, 2, 1, "Single label intensity analysis."); Dialog.show; choice = Dialog.getRadioButton; if (choice=="Count labeled cells.") { run("__sub_PASCAL_count"); } else { if (choice=="Single label intensity analysis.") { run("__sub_PASCAL_single"); } } } ////////////////////////// macro "__sub_PASCAL_count" { //count labeled cells import_type=4; countCount = 1 countCount++ if (countCount == 2) { Dialog.create("Count Labeled Cells."); items = newArray("Yes, continue.", "No. Go back to make summed z-stacks before continuing."); Dialog.addRadioButtonGroup("For this analysis, you will import previously summed z-stacks for automated counting of labeled cells. \n Do you have summed files ready?", items, 2, 1, "Yes, continue."); Dialog.show; choice = Dialog.getRadioButton; if (choice=="No. Go back to make summed z-stacks before continuing.") { run("PASCAL"); } else { wait(1); } } else { wait(1); } open(); run("Set Measurements...", "area mean standard min redirect=None decimal=3"); run("Set Scale...", "distance=1.194 known=1 pixel=1 unit=um global"); dir = getDirectory("image"); print(dir); name = getTitle; full_name = getTitle; index = lastIndexOf(name, "."); if (index!=-1) name = substring(name, 0, index); print("\n"+name+" loaded."); first_open = name; run("__sub_PASCAL_BackgroundAndROIs"); } ////////////////////////// macro "__sub_PASCAL_single" { print("PASCAL! Perineuronal net Intensity Program Specifically Quantifying ECMs Automatically."); print("\n"+"Copyright (C) 2016, John H. Harkness, PhD"); print("Protocol by Megan Slaker"); print("Lab of Barb Sorg, Washington State University, Vancouver"); wait(1000); Dialog.create("Import Type"); items = newArray("Semiautomated analysis of raw, non-summed, individual Tiffs", "Semiautomated analysis of summed Z-stack", "Automatic analysis of summed Z-stacks","\n___________________________________________\n\nMake summed image from z-stacks.\n\n\n"); Dialog.addRadioButtonGroup("What type of file do you want to import?", items, 4, 1, "Raw, non-summed, individual Tiffs"); Dialog.show; choice = Dialog.getRadioButton; if (choice=="Semiautomated analysis of raw, non-summed, individual Tiffs") { run("__sub_PASCAL_Import"); } else { if (choice=="Semiautomated analysis of summed Z-stack") { run("__sub_PASCAL_Import_Summed"); } if (choice=="Automatic analysis of summed Z-stacks") { run("__sub_PASCAL_Auto_Import_Summed"); } if (choice=="\n___________________________________________\n\nMake summed image from z-stacks.\n\n\n") { run("__sub_PASCAL_z-project"); } } } ///////////////////////////// macro "__sub_PASCAL_Import" { // Importing stacks import_type=1; run("Image Sequence...", "disable_global convert sort"); selectWindow("Stacks"); run("Set Measurements...", "area mean standard min redirect=None decimal=3"); run("Z Project...", "projection=[Sum Slices]"); run("Set Scale...", "distance=1.194 known=1 pixel=1 unit=um global"); name = File.getName(File.directory); full_name = "SUM_Stacks"; print("\n"+name+" loaded."); run("__sub_PASCAL_BackgroundAndROIs"); } ///////////////////////////// macro "__sub_PASCAL_Import_Summed" { // Importing image import_type=2; open(); run("Set Measurements...", "area mean standard min redirect=None decimal=3"); run("Set Scale...", "distance=1.194 known=1 pixel=1 unit=um global"); dir = getDirectory("image"); print(dir); name = getTitle; full_name = getTitle; index = lastIndexOf(name, "."); if (index!=-1) name = substring(name, 0, index); print("\n"+name+" loaded."); first_open = name; run("__sub_PASCAL_BackgroundAndROIs"); } //////////////////////////////// macro "__sub_PASCAL_Auto_Import_Summed" { // Importing image import_type=3; open(); run("Set Measurements...", "area mean standard min redirect=None decimal=3"); run("Set Scale...", "distance=1.194 known=1 pixel=1 unit=um global"); dir = getDirectory("image"); name = getTitle; full_name = getTitle; index = lastIndexOf(name, "."); if (index!=-1) name = substring(name, 0, index); print("\n"+name+" loaded."); first_open = name; waitForUser("Please don't touch", "Please let the macro run without clicking windows. Disruption may cause the macro to stall."); run("__sub_PASCAL_BackgroundAndROIs"); } //////////////////////////////// macro "__sub_PASCAL_z-project" { //makes summed image from z-stack top_dir = getDirectory("Choose a Directory "); count = 1; listFiles(top_dir); function listFiles(top_dir) { list = getFileList(top_dir+"/.."); parentlist = File.getParent(top_dir); for (i=0; i