Login  Register

Re: Fwd: ImageJ projection of 4D stack

Posted by Aryeh Weiss on Dec 08, 2009; 2:56pm
URL: http://imagej.273.s1.nabble.com/Re-ImageJ-projection-of-4D-stack-tp3690178p3690181.html

Wayne (almost immediately) added the required functionality to allow teh
macro to get all of the information that it needs. I attached a version
that will determine the number of slices and other relevant dimensions.
I have not used it for a while, so I am not sure that it still works
without modification, but it shoudl show you what you need to do.

--aryeh

David Knecht wrote:

> I am trying to do an extended depth of focus on a stack.  I found this
> macro from Joachim to do the job, but it is set for 256x256 and 7
> frames.  Is there a way to make this general or another way to do EDF on
> a stack?  Thanks- Dave
>
> Begin forwarded message:
>
>> From: Joachim Walter <[hidden email]>
>> Date: May 14, 2007 5:38:09 AM EDT
>> To: [hidden email]
>> Subject: Re: ImageJ projection of 4D stack
>> Reply-To: ImageJ Interest Group <[hidden email]>
>>
>> Aryeh,
>>
>> here is a short macro to do this with the "Stack Focuser", which also
>> does Extended Depht of Field. The EPFL Extended Depht of Field Plugin
>> is not macro scriptable.
>>
>> Wayne, there is currently no way to retrieve the number of channels or
>> frames of an Image in a macro. Could you add "nChannels" and "nFrames"
>> commands similar to the "nSlices" command?
>>
>> Best wishes,
>> Joachim
>>
>>
>>
>> // Macro start
>> idOrig = getImageID();
>> name = getTitle();
>> nFrames = 7;
>>
>> run("New Image5D", "name="+name+"-ExtDepth type=8-bit fill=Black
>> width=256 height=256 channels=1 slices=1 frames="+nFrames);
>> idExtDepth = getImageID();
>>
>> for (i=1; i<=nFrames; i++) {
>> selectImage(idOrig);
>> run("Set Position", "frame="+i);
>> run("Stack Focuser ", "enter=11");
>> run("Select All");
>> run("Copy");
>> run("Close");
>> selectImage(idExtDepth);
>> run("Set Position", "frame="+i);
>> run("Paste");
>> }
>>
>> Aryeh Weiss schrieb:
>>> I have a question about Image5D similar to the question below. I want
>>> to take an XYZT series, and reduce it to XYT by running the extended
>>> depth of field plugin on the z-stacks. Can this be done in Image5D,
>>> of has someone done something similar?
>>> --aryeh
>>>
>>> On Sat, 9 Dec 2006 18:15:53 +0100, Joachim Walter <[hidden email]-
>>> MUENCHEN.DE> wrote:
>>>
>>>
>>>> You can use the Image5D plugin.
>>>> - If you have your data as separate 2D TIFF images all in one
>>>> directory,
>>>> you open them with the Virtual Image5D opener.
>>>> - Click on the "Color" button and assign a color to each channel (not
>>>> limited to RGB)
>>>> - Use "Z Project" of the Image5D plugins. In the window that pops up
>>>> you
>>>> have to select "All Time Frames".
>>>> The resulting series of projections has to fit in memory, though.
>>>>
>>>>
>>>> Rainer Kohler schrieb:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have a time series of image stacks with three channels from
>>>>> FluoView. Size 1 GB.
>>>>> How can I project the z-stacks to create a time series of the
>>>>> projections of merged images as well as of the separate channels.
>>>>> Because of memory restrictions it seems not to work in FluoView.
>>>>> Could I do it in ImageJ?
>>>>>
>>
>>
>> --
>> -----------------------------------------------
>> Dr. Joachim Walter
>>
>> TILL I.D. GmbH
>> c\o BioImaging Zentrum
>> Großhaderner Str. 2
>> D-82152 Martinsried
>>
>> Tel.: +49-89-2180-74189
>> Fax:  +49-89-2180-9974189
>> Geschäftsführer: Dr. Rainer Uhl
>> HRB 129399 Amtsgericht München
>> USt.-IdNr. DE 205045721
>
> Dr. David Knecht
> Department of Molecular and Cell Biology
> Co-head Flow Cytometry and Confocal Microscopy Facility
> U-3125
> 91 N. Eagleville Rd.
> University of Connecticut
> Storrs, CT 06269
> 860-486-2200
> 860-486-4331 (fax)
>

--
Aryeh Weiss
School of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051


  requires("1.38s");
  id = getImageID();
  getDimensions(width, height, channels, slices, frames);
  run("New Image5D", "name="+getTitle+"-ExtDepth type="
    +bitDepth+"-bit fill=Black width="+width+" height="+height+" channels="
    +channels+" slices=1 frames="+frames);
  id2 = getImageID();
  setBatchMode(true);
 
  for (i=1; i<=frames; i++) {
     for (ch=1; ch<=channels; ch++) {
        selectImage(id);
        run("Set Position", "channel="+ch+" frame="+i);
        run("Median...", "radius=1 stack");
        run("Stack Focuser ", "enter=5");
        run("Copy");
        close;
        selectImage(id2);
        run("Set Position", "channel="+ch+" frame="+i);
        run("Paste");
          resetMinAndMax;
        run("Grays");
     }
 
 // resetMinAndMax;
// run("Grays");
}