Cross correlation map with ROI in a stack

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

Cross correlation map with ROI in a stack

Dotan Kamber
Hi list
I have a time laps stack how can I get a cross corellation (in time) map of each pixel with the Z-axis Profile of an ROI I choose.
Regards
Dotan
Reply | Threaded
Open this post in threaded view
|

Re: Cross correlation map with ROI in a stack

Gluender-3
Dotan,

as far as I understand your description, you wish to perform a bundle
of one-dimensional correlations. We had this question on the list
before.

Because ImageJ serves for image processing, not for the processing
one-dimensional signals, you either need to write a macro to perform
this task or you export the one-dimensional signals to another
application that is suited to do the job.

But maybe I misunderstood your description.

>Hi list I have a time laps stack how can I get a cross corellation
>(in time) map of each pixel with the Z-axis Profile of an ROI I
>choose. Regards Dotan

HTH
--

                   Herbie

          ------------------------
          <http://www.gluender.de>
Reply | Threaded
Open this post in threaded view
|

Re: Cross correlation map with ROI in a stack

Dotan Kamber
In reply to this post by Dotan Kamber
You understood well.
I guess it's about time I'll try to write the macro to do that.

Thanks
Dotan

On Thu, 18 Feb 2010 12:25:00 +0100, Gluender <[hidden email]> wrote:

>Dotan,
>
>as far as I understand your description, you wish to perform a bundle
>of one-dimensional correlations. We had this question on the list
>before.
>
>Because ImageJ serves for image processing, not for the processing
>one-dimensional signals, you either need to write a macro to perform
>this task or you export the one-dimensional signals to another
>application that is suited to do the job.
>
>But maybe I misunderstood your description.
>
>>Hi list I have a time laps stack how can I get a cross corellation
>>(in time) map of each pixel with the Z-axis Profile of an ROI I
>>choose. Regards Dotan
>
>HTH
>--
>
>                   Herbie
>
>          ------------------------
>          <http://www.gluender.de>
>=========================================================================
Reply | Threaded
Open this post in threaded view
|

Re: Cross correlation map with ROI in a stack

David Webster
In reply to this post by Dotan Kamber
Dotan,

If you go to the ImageJ Wiki under Stacks/3D Filters, you will find a
package that does, amongst other things, "3D cross-correlation between two
images" Is this what you are lokking for.

David

On Thu, Feb 18, 2010 at 2:21 AM, Dotan Kamber <[hidden email]> wrote:

> Hi list
> I have a time laps stack how can I get a cross corellation (in time) map
> of each pixel with the Z-axis Profile of an ROI I choose.
> Regards
> Dotan
>
Reply | Threaded
Open this post in threaded view
|

Re: Cross correlation map with ROI in a stack

Dotan Kamber
In reply to this post by Dotan Kamber
Just tested it and either it's not what I was looking for or I simply don't
understand the result.
I have a stack and I want to define an ROI in XY and get a cross correlation
score map of the defined ROI Z-axis Profile with each pixels Z-axis profile.

On Thu, 18 Feb 2010 18:31:18 -0800, David Webster <[hidden email]> wrote:

>Dotan,
>
>If you go to the ImageJ Wiki under Stacks/3D Filters, you will find a
>package that does, amongst other things, "3D cross-correlation between two
>images" Is this what you are lokking for.
>
>David
>
>On Thu, Feb 18, 2010 at 2:21 AM, Dotan Kamber <[hidden email]> wrote:
>
>> Hi list
>> I have a time laps stack how can I get a cross corellation (in time) map
>> of each pixel with the Z-axis Profile of an ROI I choose.
>> Regards
>> Dotan
>>
>=========================================================================
Reply | Threaded
Open this post in threaded view
|

AW: Cross correlation map with ROI in a stack

Thies Schroeder
You may need to redefine your question. The cross correlation function will list how often each xy combination occurs in the compared images. the output is a triple column: (1) the x value, (2) the y value, and (3) the number of events for this combination. I have used a not very elegant Excel-based approach to get medians and percentiles out of this chart, which however works for me. Let me know if you want me to share.

Thies



----- Ursprüngliche Mail ----
Von: Dotan Kamber <[hidden email]>
An: [hidden email]
Gesendet: Freitag, den 19. Februar 2010, 8:54:21 Uhr
Betreff: Re: Cross correlation map with ROI in a stack

Just tested it and either it's not what I was looking for or I simply don't
understand the result.
I have a stack and I want to define an ROI in XY and get a cross correlation
score map of the defined ROI Z-axis Profile with each pixels Z-axis profile.

On Thu, 18 Feb 2010 18:31:18 -0800, David Webster <[hidden email]> wrote:

>Dotan,
>
>If you go to the ImageJ Wiki under Stacks/3D Filters, you will find a
>package that does, amongst other things, "3D cross-correlation between two
>images" Is this what you are lokking for.
>
>David
>
>On Thu, Feb 18, 2010 at 2:21 AM, Dotan Kamber <[hidden email]> wrote:
>
>> Hi list
>> I have a time laps stack how can I get a cross corellation (in time) map
>> of each pixel with the Z-axis Profile of an ROI I choose.
>> Regards
>> Dotan
>>
>=========================================================================

Reply | Threaded
Open this post in threaded view
|

Re: AW: Cross correlation map with ROI in a stack

Dotan Kamber
In reply to this post by Dotan Kamber
I'll to redefine then -
I want to analyze XY time-laps calcium imaging in neuronal culture to
determine which neurons are connected.
To do that I want to select an ROI on one cell of interest and get the (XY)
correlation map in which neurons with correlated calcium dynamics will get
higher value.
The cross-correlation in this case is between the Z-axis profile of each XY
coordinates and that of the ROI and the representation is an XY image with
the cross correlation values.

Dotan

>You may need to redefine your question. The cross correlation function will
list how often each xy combination occurs in the compared images. the output
is a triple column: (1) the x value, (2) the y value, and (3) the number of
events for this combination. I have used a not very elegant Excel-based
approach to get medians and percentiles out of this chart, which however
works for me. Let me know if you want me to share.

Thies



>
Gesendet: Freitag, den 19. Februar 2010, 8:54:21 Uhr
Betreff: Re: Cross correlation map with ROI in a stack

Just tested it and either it's not what I was looking for or I simply don't
understand the result.
I have a stack and I want to define an ROI in XY and get a cross correlation
score map of the defined ROI Z-axis Profile with each pixels Z-axis profile.

On Thu, 18 Feb 2010 18:31:18 -0800, David Webster <[hidden email]> wrote:

>Dotan,
>
>If you go to the ImageJ Wiki under Stacks/3D Filters, you will find a
>package that does, amongst other things, "3D cross-correlation between two
>images" Is this what you are lokking for.
>
>David
>
>On Thu, Feb 18, 2010 at 2:21 AM, Dotan Kamber wrote:
>
>> Hi list
>> I have a time laps stack how can I get a cross corellation (in time) map
>> of each pixel with the Z-axis Profile of an ROI I choose.
>> Regards
>> Dotan
>>
>=========================================================================

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

AW: AW: Cross correlation map with ROI in a stack

Thies Schroeder
I suggest the following: Assuming that all images were taken in exactly the same position, and with the same exposure time, you could try to divide one image by the other, i.e. the "next" one by the "first" one. This could be done using Process\Image Calculator. For those cells with non-changing values, you should get grayscale values around 1 in each pixel, for changing values, you should see a concomitant change, dependent on the degree of functional connectivity. You do not need to draw ROIs for this approach.
Sounds like a cool project.

Thies



----- Ursprüngliche Mail ----
Von: Dotan Kamber <[hidden email]>
An: [hidden email]
Gesendet: Samstag, den 20. Februar 2010, 14:34:35 Uhr
Betreff: Re: AW: Cross correlation map with ROI in a stack

I'll to redefine then -
I want to analyze XY time-laps calcium imaging in neuronal culture to
determine which neurons are connected.
To do that I want to select an ROI on one cell of interest and get the (XY)
correlation map in which neurons with correlated calcium dynamics will get
higher value.
The cross-correlation in this case is between the Z-axis profile of each XY
coordinates and that of the ROI and the representation is an XY image with
the cross correlation values.

Dotan

>You may need to redefine your question. The cross correlation function will
list how often each xy combination occurs in the compared images. the output
is a triple column: (1) the x value, (2) the y value, and (3) the number of
events for this combination. I have used a not very elegant Excel-based
approach to get medians and percentiles out of this chart, which however
works for me. Let me know if you want me to share.

Thies



>
Gesendet: Freitag, den 19. Februar 2010, 8:54:21 Uhr
Betreff: Re: Cross correlation map with ROI in a stack

Just tested it and either it's not what I was looking for or I simply don't
understand the result.
I have a stack and I want to define an ROI in XY and get a cross correlation
score map of the defined ROI Z-axis Profile with each pixels Z-axis profile.

On Thu, 18 Feb 2010 18:31:18 -0800, David Webster <[hidden email]> wrote:

>Dotan,
>
>If you go to the ImageJ Wiki under Stacks/3D Filters, you will find a
>package that does, amongst other things, "3D cross-correlation between two
>images" Is this what you are lokking for.
>
>David
>
>On Thu, Feb 18, 2010 at 2:21 AM, Dotan Kamber wrote:
>
>> Hi list
>> I have a time laps stack how can I get a cross corellation (in time) map
>> of each pixel with the Z-axis Profile of an ROI I choose.
>> Regards
>> Dotan
>>
>=========================================================================

>========================================================================

Reply | Threaded
Open this post in threaded view
|

Re: Cross correlation map with ROI in a stack

Dotan Kamber
In reply to this post by Dotan Kamber
Following is a macro I wrote.
I'm sure you will all notice my lack of skills and any improvement to the
macro is welcome.
The macro requires a time series with selection.
If it is used with z stack it will transform the z (slices) to t (frames).

// This tool generate a cross correlation XY map of every XY point
// and a reference region of interest in a time-laps stack.
// This tool is meant to find interconnected neurons by the correlation
// of their calcium signals.

macro "crosscorrmap" {
        getDimensions(width, height, channels, slices, frames);
        if (slices>1){
                print("will transform the Z axis to T");
                Stack.setDimensions(channels,frames,slices);
        }
        getDimensions(width, height, channels, slices, frames);
  if (frames==1)
                exit("This macro requires a time-laps stack");
        if(3<selectionType || selectionType<0)
                exit("This macro requires a region of interest");
        setBatchMode(true);
        setSelectionName("ROI");
        //Register the ROI
        roiManager("Add");
        roiindex=roiManager("count")-1;
        original_stack=getImageID;
        run("Z Project...", "projection=[Average Intensity]");//Get
average projection
        averaged_image=getImageID();
        roiManager("select",roiindex);
        getStatistics(area, roiaveraged);
        //The ROI average over the entire stack
        imageCalculator("Subtract create 32-bit stack", original_stack,
averaged_image);
        subtracted_stack=getImageID(); //Result
of original stack minus it's average
        roival = newArray(frames);
        denominatorroi=0;
        for (z=1; z<=frames; z++) {
        //Retrieving the ROI's z-axis values from the subtracted stack
// setZCoordinate(z);
                Stack.setFrame(z);
                roiManager("select",roiindex);
                getStatistics(area, roislice);
                roival[z-1]=roislice;
                denominatorroi=denominatorroi+(roival[z-1]*roival[z-1]);
        }
        newImage("CrossCorrMap","32bit",width, height,1);
        crosscorrmap=getImageID();
        for (x=0; x<width; x++){
        //Runs over every XY pixel and check cross correlation with ROI
                for (y=0; y<height; y++){
                        numerator=0;
                        denominatorpixel=0;
                        for (z=1; z<=frames; z++) {
        //retrieving the pixels's z-axis values from teh subtracted stack
                                selectImage(subtracted_stack);
// setZCoordinate(z-1);
                                Stack.setPosition(1,1,z);
                                pixelval=getPixel(x,y);
                                numerator=numerator+(roival[z-1]*pixelval);
                                denominatorpixel=denominatorpixel+
(pixelval*pixelval);
                        }
                        crosscorrelationval=numerator / (sqrt
(denominatorroi) * sqrt (denominatorpixel));
                        selectImage(crosscorrmap);
                        setPixel(x,y,crosscorrelationval); //Store
the result for every XY pixel
                        showProgress(x/width); //The
proccess is quit time consuming at the moment
                }
        }
setBatchMode(false);
selectImage(crosscorrmap);
}

On Thu, 18 Feb 2010 12:25:00 +0100, Gluender <[hidden email]> wrote:

>Dotan,
>
>as far as I understand your description, you wish to perform a bundle
>of one-dimensional correlations. We had this question on the list
>before.
>
>Because ImageJ serves for image processing, not for the processing
>one-dimensional signals, you either need to write a macro to perform
>this task or you export the one-dimensional signals to another
>application that is suited to do the job.
>
>But maybe I misunderstood your description.
>
>>Hi list I have a time laps stack how can I get a cross corellation
>>(in time) map of each pixel with the Z-axis Profile of an ROI I
>>choose. Regards Dotan
>
>HTH
>--
>
>                   Herbie
>
>          ------------------------
>          <http://www.gluender.de>
>=========================================================================