Login  Register

Re: combine data from multiple profile measurements of a time series to single data sheet

Posted by cpanders on Apr 20, 2016; 5:41pm
URL: http://imagej.273.s1.nabble.com/combine-data-from-multiple-profile-measurements-of-a-time-series-to-single-data-sheet-tp5016124p5016200.html

Success!  On the ImageJ forum Bio7 incorporated a macro from (https://sunhaehong.wordpress.com/2015/06/25/60/) into the stack plot macro, and it works quite nicely.  I'm posting the entire macro below for others with similar needs.  There is an image from the stacks we are measuring attached FYI.  We have 6x 24 hour timestacks captured at an 8 second frame interval, we could never analyze them without this tool.

Thank you for the assistance!
colonial marine hydroid stolon



macro "Stack profile Plot" {
    collectedValues="";
    ymin = 0;
    ymax = 255;
    saveSettings();
    if (nSlices==1)
      exit("Stack required");
    run("Profile Plot Options...",
      "width=400 height=200 minimum="+ymin+" maximum="+ymax+" fixed");
    setBatchMode(true);
    stack1 = getImageID;
    stack2 = 0;
    n = nSlices;
    for (i=1; i<n; i++) {
        showProgress(i, n);
        selectImage(stack1);
        setSlice(i);
        run("Clear Results");
          profile = getProfile();
        for (j=1; j<profile.length; j++) {
           collectedValues=collectedValues+profile[j] + "\t";
        }
        collectedValues=collectedValues+"\n";
             
        run("Plot Profile");
        run("Copy");
        w = getWidth; h = getHeight;
        close();
        if (stack2==0) {
            newImage("Plots", "8-bit", w, h, 1);
            stack2 = getImageID;
        } else {
            selectImage(stack2);
            run("Add Slice");
        }
        run("Paste");
    }
   
    f = File.open("/Users/evanbuss/Documents/CA Analysis 2013/Polyp Removal 2016/stack profile data/profileValues.txt");
    print(f, collectedValues);
    setSlice(1);
    setBatchMode(false);
    restoreSettings();
}