RGB profiler

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RGB profiler

Cammer, Michael
Is there an RGB or multichannel profiler for 16 bit images?
Thanks!

________________________________________________________
Michael Cammer, Assistant Research Scientist
Skirball Institute of Biomolecular Medicine
Lab: (212) 263-3208  Cell: (914) 309-3270

</PRE>
<html>
<body>
------------------------------------------------------------<br />
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email.<br />
=================================
</body>
</html>
<PRE>
Reply | Threaded
Open this post in threaded view
|

Re: RGB profiler

dpoburko
On 4/29/2011 2:13 PM, Cammer, Michael wrote:
> Is there an RGB or multichannel profiler for 16 bit images?
> Thanks!
>
> ________________________________________________________
> Michael Cammer, Assistant Research Scientist
> Skirball Institute of Biomolecular Medicine
> Lab: (212) 263-3208  Cell: (914) 309-3270
Hi Michael,

  Based on some previous threads, I worked up the code below. I am
pretty sure that there are other macros around that have a very similar
function. Feel free to have a whirl with this and see what you think.

(code below)

Damon--

Post Doctoral Fellow
Tsien Lab, Molecular&  Cellular Physiology
Stanford University

requires("1.42l");
print("\\Clear");                     //clear log
print("Results", "\\Clear");
run("Clear Results");

//================================================================================================================

        if (selectionType==-1)
                exit("Area selection required");
        run("Set Measurements...", "area mean min centroid shape redirect=None decimal=3");
        length = selectionLength();
        imageName = getTitle();
        baseName = imageName;

        selectWindow(baseName);
        setSlice(1);
                profile1=getProfile();
                Array.getStatistics(profile1, min, max, mean, stdDev);
                max1 = max;
        selectWindow(baseName);
                setSlice(2);
                profile2=getProfile();
                Array.getStatistics(profile2, min, max, mean, stdDev);
                max2 = max;
                profilesMax = maxOf(max1,max2);
        selectWindow(baseName);
        if (nSlices() == 3) {
                selectWindow(baseName);
                setSlice(3);
                profile3=getProfile();
                Array.getStatistics(profile3, min, max, mean, stdDev);
                max3 = max;
// max = maxOf(max,max3);
                profilesMax = maxOf(max3,profilesMax);
        }

chkSkipBlue = call("ij.Prefs.get", "dialogDefaults.default3", true);
        if ( (chkSkipBlue != true)&&  (chkSkipBlue != false) ) chkSkipBlue = false;

Dialog.create("Align Images");
Dialog.addCheckbox("run background subtraction?:", false);
Dialog.addNumber("rolling ball size (pixels)", 20);
Dialog.addNumber("scale green vs red", 1.0);
Dialog.addNumber("set Y Max (0 = autoscale)", 0);
Dialog.addCheckbox("common autoscale?:", false);
Dialog.addCheckbox("skip blue channel ?:", chkSkipBlue);
Dialog.addNumber("plot scale (plot width/line length))", 1);

Dialog.show();
   //----------------------------------------------------------------------------------------
runBkgdSubtr = Dialog.getCheckbox();
ballSize = Dialog.getNumber();
scaleFactor = Dialog.getNumber();
yMax = Dialog.getNumber();
commonYMax = Dialog.getCheckbox();
skipBlue = Dialog.getCheckbox();
        call("ij.Prefs.set", "dialogDefaults.default3", skipBlue);
plotScale = Dialog.getNumber();
        plotWidth = round(length / plotScale);

setBatchMode(true);

                if (runBkgdSubtr == true) run("Subtract Background...", "rolling="+ballSize+"");
                if (commonYMax == true) yMax = profilesMax;

                if (yMax == 0 ) {
                        setMax = "";
                } else {
                        setMax = "maximum="+ yMax + " fixed ";
                }
                run("Profile Plot Options...", "width="+plotWidth+" height=200 minimum=0 " + setMax + "draw");
                selectWindow(baseName);
                setSlice(1);
                run("Plot Profile");
                run("Invert");
                rename("red");
                selectWindow(baseName);
                setSlice(2);
                run("Plot Profile");
                run("Invert");
                rename("green");
                selectWindow(baseName);
                if ( (nSlices() == 3)&&  skipBlue == false) {
                        selectWindow(baseName);
                        setSlice(3);
                        run("Plot Profile");
                        run("Invert");
                        rename("blue");
                        mergeBlue = "blue";
                } else {
                        mergeBlue = "*None*";
                }

                run("Merge Channels...", "red=red green=green blue="+mergeBlue+" gray=*None* create");


setBatchMode("exit and display");

//================================================================================
//================================================================================

function selectionLength() {

      getSelectionCoordinates(x, y);
      segments = newArray(x.length-1);
      lineLength =0;
      for (i=1; i<x.length; i++) {
      segments[i-1] =  sqrt( pow( (x[i-1] - x[i]),2) + pow( (y[i-1] - y[i]),2) );
        lineLength = lineLength + segments[i-1];
      }
        return lineLength;
}

//================================================================================
//================================================================================
Reply | Threaded
Open this post in threaded view
|

Re: RGB profiler

Michael Schmid
Hi Damon, Michael,

In imageJ, 16-bit RGB images are a kind of stack, so you could try  
the StackProfilePlot and StackProfileData macros on the ImageJ web site.

Michael
________________________________________________________________

On 30 Apr 2011, at 02:41, Damon Poburko wrote:

> On 4/29/2011 2:13 PM, Cammer, Michael wrote:
>> Is there an RGB or multichannel profiler for 16 bit images?
>> Thanks!
>>
>> ________________________________________________________
>> Michael Cammer, Assistant Research Scientist
>> Skirball Institute of Biomolecular Medicine
>> Lab: (212) 263-3208  Cell: (914) 309-3270
> Hi Michael,
>
>  Based on some previous threads, I worked up the code below. I am  
> pretty sure that there are other macros around that have a very  
> similar function. Feel free to have a whirl with this and see what  
> you think.
>
> (code below)
>
> Damon--
>
> Post Doctoral Fellow
> Tsien Lab, Molecular&  Cellular Physiology
> Stanford University
>
> requires("1.42l");
> print("\\Clear");                     //clear log
> print("Results", "\\Clear");
> run("Clear Results");
>
> //
> ======================================================================
> ==========================================
>
> if (selectionType==-1)
> exit("Area selection required");
> run("Set Measurements...", "area mean min centroid shape  
> redirect=None decimal=3");
> length = selectionLength();
> imageName = getTitle();
> baseName = imageName;
>
> selectWindow(baseName);
> setSlice(1);
> profile1=getProfile();
> Array.getStatistics(profile1, min, max, mean, stdDev);
> max1 = max;
> selectWindow(baseName);
> setSlice(2);
> profile2=getProfile();
> Array.getStatistics(profile2, min, max, mean, stdDev);
> max2 = max;
> profilesMax = maxOf(max1,max2);
> selectWindow(baseName);
> if (nSlices() == 3) {
> selectWindow(baseName);
> setSlice(3);
> profile3=getProfile();
> Array.getStatistics(profile3, min, max, mean, stdDev);
> max3 = max;
> // max = maxOf(max,max3);
> profilesMax = maxOf(max3,profilesMax);
> }
>
> chkSkipBlue = call("ij.Prefs.get", "dialogDefaults.default3", true);
> if ( (chkSkipBlue != true)&&  (chkSkipBlue != false) ) chkSkipBlue  
> = false;
>
> Dialog.create("Align Images");
> Dialog.addCheckbox("run background subtraction?:", false);
> Dialog.addNumber("rolling ball size (pixels)", 20);
> Dialog.addNumber("scale green vs red", 1.0);
> Dialog.addNumber("set Y Max (0 = autoscale)", 0);
> Dialog.addCheckbox("common autoscale?:", false);
> Dialog.addCheckbox("skip blue channel ?:", chkSkipBlue);
> Dialog.addNumber("plot scale (plot width/line length))", 1);
>
> Dialog.show();
>   //------------------------------------------------------------------
> ----------------------
> runBkgdSubtr = Dialog.getCheckbox();
> ballSize = Dialog.getNumber();
> scaleFactor = Dialog.getNumber();
> yMax = Dialog.getNumber();
> commonYMax = Dialog.getCheckbox();
> skipBlue = Dialog.getCheckbox();
> call("ij.Prefs.set", "dialogDefaults.default3", skipBlue);
> plotScale = Dialog.getNumber();
> plotWidth = round(length / plotScale);
>
> setBatchMode(true);
>
> if (runBkgdSubtr == true) run("Subtract Background...",  
> "rolling="+ballSize+"");
> if (commonYMax == true) yMax = profilesMax;
>
> if (yMax == 0 ) {
> setMax = "";
> } else {
> setMax = "maximum="+ yMax + " fixed ";
> }
> run("Profile Plot Options...", "width="+plotWidth+" height=200  
> minimum=0 " + setMax + "draw");
> selectWindow(baseName);
> setSlice(1);
> run("Plot Profile");
> run("Invert");
> rename("red");
> selectWindow(baseName);
> setSlice(2);
> run("Plot Profile");
> run("Invert");
> rename("green");
> selectWindow(baseName);
> if ( (nSlices() == 3)&&  skipBlue == false) {
> selectWindow(baseName);
> setSlice(3);
> run("Plot Profile");
> run("Invert");
> rename("blue");
> mergeBlue = "blue";
> } else {
> mergeBlue = "*None*";
> }
>
> run("Merge Channels...", "red=red green=green blue="+mergeBlue+"  
> gray=*None* create");
>
>
> setBatchMode("exit and display");
>
> //
> ======================================================================
> ==========
> //
> ======================================================================
> ==========
>
> function selectionLength() {
>
>      getSelectionCoordinates(x, y);
>      segments = newArray(x.length-1);
>      lineLength =0;
>      for (i=1; i<x.length; i++) {
>       segments[i-1] =  sqrt( pow( (x[i-1] - x[i]),2) + pow( (y[i-1]  
> - y[i]),2) );
> lineLength = lineLength + segments[i-1];
>      }
> return lineLength;
> }
>
> //
> ======================================================================
> ==========
> //
> ======================================================================
> ==========