virtual stack

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

virtual stack

Knecht, David
I am trying to add a time stamp to a stack that is too large to open in ImageJ.  I added the Time Stamper plugin to a virtual stack macro to try to get it to do the job, but I get back an error message that the file is not a stack.  How do you get around this?  Dave

// Process Virtual Stack
//
// This macro demonstrates how to process the images in a
// virtual stack, save the processed images in a folder, and
// then open those images in another virtual stack. The virtual
// stack can be opened using File>Import>Image Sequence,
// File>Import>TIFF Virtual Stack or File>Import>Raw.

  if (nSlices==1) exit("Stack required");
  dir = getDirectory("Choose Destination Directory ");
  setBatchMode(true);
  id = getImageID;
  for (i=1; i<= nSlices; i++) {
      showProgress(i, nSlices);
      selectImage(id);
      setSlice(i);
      name = getMetadata;
      run("Duplicate...", "title=temp");
      run("Time Stamper");
      saveAs("tif", dir+pad(i-1));
      close();
  }
  setBatchMode(false);
  run("Image Sequence...", "open=["+dir+"00000.tif] use");

  function pad(n) {
      str = toString(n);
      while (lengthOf(str)<5)
          str = "0" + str;
      return str;
  }

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)
Reply | Threaded
Open this post in threaded view
|

Re: virtual stack

Michael Schmid
Hi Dave,

in my view, the easiest solution is using the drawString("text", x, y)
macro function instead of the TimeStamper.

Michael
_____________________________________________________________________

On Sun, March 21, 2010 14:53, David Knecht charter wrote:

> I am trying to add a time stamp to a stack that is too large to open in
> ImageJ.  I added the Time Stamper plugin to a virtual stack macro to try
> to get it to do the job, but I get back an error message that the file is
> not a stack.  How do you get around this?  Dave
>
> // Process Virtual Stack
> //
> // This macro demonstrates how to process the images in a
> // virtual stack, save the processed images in a folder, and
> // then open those images in another virtual stack. The virtual
> // stack can be opened using File>Import>Image Sequence,
> // File>Import>TIFF Virtual Stack or File>Import>Raw.
>
>   if (nSlices==1) exit("Stack required");
>   dir = getDirectory("Choose Destination Directory ");
>   setBatchMode(true);
>   id = getImageID;
>   for (i=1; i<= nSlices; i++) {
>       showProgress(i, nSlices);
>       selectImage(id);
>       setSlice(i);
>       name = getMetadata;
>       run("Duplicate...", "title=temp");
>       run("Time Stamper");
>       saveAs("tif", dir+pad(i-1));
>       close();
>   }
>   setBatchMode(false);
>   run("Image Sequence...", "open=["+dir+"00000.tif] use");
>
>   function pad(n) {
>       str = toString(n);
>       while (lengthOf(str)<5)
>           str = "0" + str;
>       return str;
>   }
>
> 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)
>
Reply | Threaded
Open this post in threaded view
|

Re: virtual stack

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Knecht, David
On Mar 21, 2010, at 9:53 AM, David Knecht charter wrote:

> I am trying to add a time stamp to a stack that is too large to open in ImageJ.  I added the Time Stamper plugin to a virtual stack macro to try to get it to do the job, but I get back an error message that the file is not a stack.  How do you get around this?  Dave

You can time stamp a virtual stack by using the Process>Batch>Macro command and entering macro code something like this:

   setFont("SansSerif", 18, "antialiased");
   setColor("white");
   n=toString(i);
   while (lengthOf(n)<4) n="0"+n;
   drawString(n, 20, 30);

The Process>Batch>Macro command was added in ImageJ 1.43.

-wayne


> // Process Virtual Stack
> //
> // This macro demonstrates how to process the images in a
> // virtual stack, save the processed images in a folder, and
> // then open those images in another virtual stack. The virtual
> // stack can be opened using File>Import>Image Sequence,
> // File>Import>TIFF Virtual Stack or File>Import>Raw.
>
>  if (nSlices==1) exit("Stack required");
>  dir = getDirectory("Choose Destination Directory ");
>  setBatchMode(true);
>  id = getImageID;
>  for (i=1; i<= nSlices; i++) {
>      showProgress(i, nSlices);
>      selectImage(id);
>      setSlice(i);
>      name = getMetadata;
>      run("Duplicate...", "title=temp");
>      run("Time Stamper");
>      saveAs("tif", dir+pad(i-1));
>      close();
>  }
>  setBatchMode(false);
>  run("Image Sequence...", "open=["+dir+"00000.tif] use");
>
>  function pad(n) {
>      str = toString(n);
>      while (lengthOf(str)<5)
>          str = "0" + str;
>      return str;
>  }
>
> 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)
Reply | Threaded
Open this post in threaded view
|

Re: virtual stack

Knecht, David
Hi Wayne- I can see how that would work, but was hoping I could make it come out in standard time units like hr:min or min:sec which is nice for a running clock.  Dave

On Mar 22, 2010, at 2:26 AM, Rasband, Wayne (NIH/NIMH) [E] wrote:

> On Mar 21, 2010, at 9:53 AM, David Knecht charter wrote:
>
>> I am trying to add a time stamp to a stack that is too large to open in ImageJ.  I added the Time Stamper plugin to a virtual stack macro to try to get it to do the job, but I get back an error message that the file is not a stack.  How do you get around this?  Dave
>
> You can time stamp a virtual stack by using the Process>Batch>Macro command and entering macro code something like this:
>
>   setFont("SansSerif", 18, "antialiased");
>   setColor("white");
>   n=toString(i);
>   while (lengthOf(n)<4) n="0"+n;
>   drawString(n, 20, 30);
>
> The Process>Batch>Macro command was added in ImageJ 1.43.
>
> -wayne
>
>
>> // Process Virtual Stack
>> //
>> // This macro demonstrates how to process the images in a
>> // virtual stack, save the processed images in a folder, and
>> // then open those images in another virtual stack. The virtual
>> // stack can be opened using File>Import>Image Sequence,
>> // File>Import>TIFF Virtual Stack or File>Import>Raw.
>>
>> if (nSlices==1) exit("Stack required");
>> dir = getDirectory("Choose Destination Directory ");
>> setBatchMode(true);
>> id = getImageID;
>> for (i=1; i<= nSlices; i++) {
>>     showProgress(i, nSlices);
>>     selectImage(id);
>>     setSlice(i);
>>     name = getMetadata;
>>     run("Duplicate...", "title=temp");
>>     run("Time Stamper");
>>     saveAs("tif", dir+pad(i-1));
>>     close();
>> }
>> setBatchMode(false);
>> run("Image Sequence...", "open=["+dir+"00000.tif] use");
>>
>> function pad(n) {
>>     str = toString(n);
>>     while (lengthOf(str)<5)
>>         str = "0" + str;
>>     return str;
>> }
>>
>> 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)

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)
Reply | Threaded
Open this post in threaded view
|

Re: virtual stack

Knecht, David
In reply to this post by Rasband, Wayne (NIH/NIMH) [E]
Can the time stamper work in hours:min:sec or just hours;min?  It doesn't seem to let me change the time increment to min in order to accomplish this.  Dave

On Mar 22, 2010, at 2:26 AM, Rasband, Wayne (NIH/NIMH) [E] wrote:

> On Mar 21, 2010, at 9:53 AM, David Knecht charter wrote:
>
>> I am trying to add a time stamp to a stack that is too large to open in ImageJ.  I added the Time Stamper plugin to a virtual stack macro to try to get it to do the job, but I get back an error message that the file is not a stack.  How do you get around this?  Dave
>
> You can time stamp a virtual stack by using the Process>Batch>Macro command and entering macro code something like this:
>
>   setFont("SansSerif", 18, "antialiased");
>   setColor("white");
>   n=toString(i);
>   while (lengthOf(n)<4) n="0"+n;
>   drawString(n, 20, 30);
>
> The Process>Batch>Macro command was added in ImageJ 1.43.
>
> -wayne
>
>
>> // Process Virtual Stack
>> //
>> // This macro demonstrates how to process the images in a
>> // virtual stack, save the processed images in a folder, and
>> // then open those images in another virtual stack. The virtual
>> // stack can be opened using File>Import>Image Sequence,
>> // File>Import>TIFF Virtual Stack or File>Import>Raw.
>>
>> if (nSlices==1) exit("Stack required");
>> dir = getDirectory("Choose Destination Directory ");
>> setBatchMode(true);
>> id = getImageID;
>> for (i=1; i<= nSlices; i++) {
>>     showProgress(i, nSlices);
>>     selectImage(id);
>>     setSlice(i);
>>     name = getMetadata;
>>     run("Duplicate...", "title=temp");
>>     run("Time Stamper");
>>     saveAs("tif", dir+pad(i-1));
>>     close();
>> }
>> setBatchMode(false);
>> run("Image Sequence...", "open=["+dir+"00000.tif] use");
>>
>> function pad(n) {
>>     str = toString(n);
>>     while (lengthOf(str)<5)
>>         str = "0" + str;
>>     return str;
>> }
>>
>> 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)

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)
Reply | Threaded
Open this post in threaded view
|

Re: virtual stack

Knecht, David
In reply to this post by Rasband, Wayne (NIH/NIMH) [E]
I am also trying to get the labeling of the time interval to work with the macro Wayne supplied.  I don't know how to convert this to get the correct frame interval.  I still a novice with the macro language and am not sure what to do .  In the macro below, what does the i in the first line set?  What sets the step interval in the second line?  Right now it starts at zero and increments by 1, but I don't see how that is set or how to change it.   Thanks- Dave

 n=toString(i);
while (lengthOf(n)<4) n="0"+n;

On Mar 22, 2010, at 2:26 AM, Rasband, Wayne (NIH/NIMH) [E] wrote:

> On Mar 21, 2010, at 9:53 AM, David Knecht charter wrote:
>
>> I am trying to add a time stamp to a stack that is too large to open in ImageJ.  I added the Time Stamper plugin to a virtual stack macro to try to get it to do the job, but I get back an error message that the file is not a stack.  How do you get around this?  Dave
>
> You can time stamp a virtual stack by using the Process>Batch>Macro command and entering macro code something like this:
>
>   setFont("SansSerif", 18, "antialiased");
>   setColor("white");
>   n=toString(i);
>   while (lengthOf(n)<4) n="0"+n;
>   drawString(n, 20, 30);
>
> The Process>Batch>Macro command was added in ImageJ 1.43.
>
> -wayne
>
>
>> // Process Virtual Stack
>> //
>> // This macro demonstrates how to process the images in a
>> // virtual stack, save the processed images in a folder, and
>> // then open those images in another virtual stack. The virtual
>> // stack can be opened using File>Import>Image Sequence,
>> // File>Import>TIFF Virtual Stack or File>Import>Raw.
>>
>> if (nSlices==1) exit("Stack required");
>> dir = getDirectory("Choose Destination Directory ");
>> setBatchMode(true);
>> id = getImageID;
>> for (i=1; i<= nSlices; i++) {
>>     showProgress(i, nSlices);
>>     selectImage(id);
>>     setSlice(i);
>>     name = getMetadata;
>>     run("Duplicate...", "title=temp");
>>     run("Time Stamper");
>>     saveAs("tif", dir+pad(i-1));
>>     close();
>> }
>> setBatchMode(false);
>> run("Image Sequence...", "open=["+dir+"00000.tif] use");
>>
>> function pad(n) {
>>     str = toString(n);
>>     while (lengthOf(str)<5)
>>         str = "0" + str;
>>     return str;
>> }
>>
>> 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)

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)
Reply | Threaded
Open this post in threaded view
|

Re: virtual stack

Rasband, Wayne (NIH/NIMH) [E]
On Mar 27, 2010, at 6:21 PM, David Knecht charter wrote:

> I am also trying to get the labeling of the time interval to work with the macro Wayne supplied.  I don't know how to convert this to get the correct frame interval.  I still a novice with the macro language and am not sure what to do .  In the macro below, what does the i in the first line set?  What sets the step interval in the second line?  Right now it starts at zero and increments by 1, but I don't see how that is set or how to change it.   Thanks- Dave
>
> n=toString(i);
> while (lengthOf(n)<4) n="0"+n;

Here is an updated timestamp macro for use with Process>Batch>Macro or Process>Batch>Virtual Stack that draws in hr:mn:sc format and allows you to set the frame interval. The 'i' variable is the image index. It is 0 for the first image, 1 for the second image, etc.

-wayne

  frameInterval=1; //seconds
  i = floor(i* frameInterval); // 'i' is the image index
  setFont("SansSerif", 18, "antialiased");
  setColor("white");
  s = ""+pad(floor(i/3600))+":"+pad(floor((i/60)%60))
     +":"+pad(i%60);
  drawString(s, 20, 30);

  function pad(n) {
      str = toString(n);
      if (lengthOf(str)==1) str="0"+str;
      return str;
  }


>
> On Mar 22, 2010, at 2:26 AM, Rasband, Wayne (NIH/NIMH) [E] wrote:
>
>> On Mar 21, 2010, at 9:53 AM, David Knecht charter wrote:
>>
>>> I am trying to add a time stamp to a stack that is too large to open in ImageJ.  I added the Time Stamper plugin to a virtual stack macro to try to get it to do the job, but I get back an error message that the file is not a stack.  How do you get around this?  Dave
>>
>> You can time stamp a virtual stack by using the Process>Batch>Macro command and entering macro code something like this:
>>
>>  setFont("SansSerif", 18, "antialiased");
>>  setColor("white");
>>  n=toString(i);
>>  while (lengthOf(n)<4) n="0"+n;
>>  drawString(n, 20, 30);
>>
>> The Process>Batch>Macro command was added in ImageJ 1.43.
>>
>> -wayne
>>
>>
>>> // Process Virtual Stack
>>> //
>>> // This macro demonstrates how to process the images in a
>>> // virtual stack, save the processed images in a folder, and
>>> // then open those images in another virtual stack. The virtual
>>> // stack can be opened using File>Import>Image Sequence,
>>> // File>Import>TIFF Virtual Stack or File>Import>Raw.
>>>
>>> if (nSlices==1) exit("Stack required");
>>> dir = getDirectory("Choose Destination Directory ");
>>> setBatchMode(true);
>>> id = getImageID;
>>> for (i=1; i<= nSlices; i++) {
>>>    showProgress(i, nSlices);
>>>    selectImage(id);
>>>    setSlice(i);
>>>    name = getMetadata;
>>>    run("Duplicate...", "title=temp");
>>>    run("Time Stamper");
>>>    saveAs("tif", dir+pad(i-1));
>>>    close();
>>> }
>>> setBatchMode(false);
>>> run("Image Sequence...", "open=["+dir+"00000.tif] use");
>>>
>>> function pad(n) {
>>>    str = toString(n);
>>>    while (lengthOf(str)<5)
>>>        str = "0" + str;
>>>    return str;
>>> }
>>>
>>> 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)
>
> 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)
Reply | Threaded
Open this post in threaded view
|

Re: virtual stack

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Knecht, David
On Mar 27, 2010, at 12:57 PM, David Knecht charter <[hidden email]
 > wrote:

> Can the time stamper work in hours:min:sec or just hours;min?  It  
> doesn't seem to let me change the time increment to min in order to  
> accomplish this.  Dave

The Image>Stacks>Label command in the 1.43t daily build works with  
both 00:00:00 and 00:00 formats.

-wayne


> On Mar 22, 2010, at 2:26 AM, Rasband, Wayne (NIH/NIMH) [E] wrote:
>
>> On Mar 21, 2010, at 9:53 AM, David Knecht charter wrote:
>>
>>> I am trying to add a time stamp to a stack that is too large to  
>>> open in ImageJ.  I added the Time Stamper plugin to a virtual  
>>> stack macro to try to get it to do the job, but I get back an  
>>> error message that the file is not a stack.  How do you get around  
>>> this?  Dave
>>
>> You can time stamp a virtual stack by using the Process>Batch>Macro  
>> command and entering macro code something like this:
>>
>>  setFont("SansSerif", 18, "antialiased");
>>  setColor("white");
>>  n=toString(i);
>>  while (lengthOf(n)<4) n="0"+n;
>>  drawString(n, 20, 30);
>>
>> The Process>Batch>Macro command was added in ImageJ 1.43.
>>
>> -wayne
>>
>>
>>> // Process Virtual Stack
>>> //
>>> // This macro demonstrates how to process the images in a
>>> // virtual stack, save the processed images in a folder, and
>>> // then open those images in another virtual stack. The virtual
>>> // stack can be opened using File>Import>Image Sequence,
>>> // File>Import>TIFF Virtual Stack or File>Import>Raw.
>>>
>>> if (nSlices==1) exit("Stack required");
>>> dir = getDirectory("Choose Destination Directory ");
>>> setBatchMode(true);
>>> id = getImageID;
>>> for (i=1; i<= nSlices; i++) {
>>>    showProgress(i, nSlices);
>>>    selectImage(id);
>>>    setSlice(i);
>>>    name = getMetadata;
>>>    run("Duplicate...", "title=temp");
>>>    run("Time Stamper");
>>>    saveAs("tif", dir+pad(i-1));
>>>    close();
>>> }
>>> setBatchMode(false);
>>> run("Image Sequence...", "open=["+dir+"00000.tif] use");
>>>
>>> function pad(n) {
>>>    str = toString(n);
>>>    while (lengthOf(str)<5)
>>>        str = "0" + str;
>>>    return str;
>>> }
>>>
>>> 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)
>
> 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)