Slice labels and hyperstacks

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

Slice labels and hyperstacks

Fred Damen
Greetings,

It seems as though slice labels can not be set on a hyperstack with one slice
and one frame, see code below.  If ns>1 or nf>1 then the label is setable and
fetchable.

I believe that this may be the cause of (new
ImageCalculator()).run(String,ImagePlus,ImagePlus) and/or
IJ.run(ImagePlus,math operations, options) to remove the slice labels when one
of the parameters is a hypertack with ns==1 and nf==1; as this is happening
and given the aforementioned bug.

Thanks,

Fred

PS: https://imagej.nih.gov/ is not responding...

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;

public class My_Plugin implements PlugIn {

   public void run(String arg) {
      int ns=1,nf=1;
      ImagePlus imp = IJ.createImage("A", "32-bit grayscale-mode", 128, 128,
1, ns, nf);

      imp.getStack().setSliceLabel("imp label",1);
      IJ.log("A="+imp.getStack().getSliceLabel(1));
      }

}

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Slice labels and hyperstacks

Wayne Rasband-2
> On May 1, 2018, at 8:18 PM, Fred Damen <[hidden email]> wrote:
>
> Greetings,
>
> It seems as though slice labels can not be set on a hyperstack with one slice
> and one frame, see code below.  If ns>1 or nf>1 then the label is setable and
> fetchable.

This bug is fixed in the latest ImageJ daily build (1.52b20).

-wayne

> I believe that this may be the cause of (new
> ImageCalculator()).run(String,ImagePlus,ImagePlus) and/or
> IJ.run(ImagePlus,math operations, options) to remove the slice labels when one
> of the parameters is a hypertack with ns==1 and nf==1; as this is happening
> and given the aforementioned bug.
>
> Thanks,
>
> Fred
>
> PS: https://imagej.nih.gov/ is not responding...
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
>
> public class My_Plugin implements PlugIn {
>
>   public void run(String arg) {
>      int ns=1,nf=1;
>      ImagePlus imp = IJ.createImage("A", "32-bit grayscale-mode", 128, 128,
> 1, ns, nf);
>
>      imp.getStack().setSliceLabel("imp label",1);
>      IJ.log("A="+imp.getStack().getSliceLabel(1));
>      }
>
> }

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Slice labels and hyperstacks

Fred Damen
Greetings,

Is seems as though the ImagePlus.duplicate does not copy the slice labels of
hyperstacks with nz==1 and nf==1.
version 1.52b21

Thanks,

Fred

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;

public class TestDuplicate implements PlugIn {

   public void run(String arg) {
      int nz=1, nf=1;
      ImagePlus imp = IJ.createHyperStack("HSI",128,128,1,nz,nf,32);
      imp.getStack().setSliceLabel("label 1\nvar = val",1);
      ImagePlus dupimp = imp.duplicate();
      IJ.log("LABEL="+dupimp.getStack().getSliceLabel(1));
      }

}

On Wed, May 2, 2018 6:24 pm, Wayne Rasband wrote:

>> On May 1, 2018, at 8:18 PM, Fred Damen <[hidden email]> wrote:
>>
>> Greetings,
>>
>> It seems as though slice labels can not be set on a hyperstack with one
>> slice
>> and one frame, see code below.  If ns>1 or nf>1 then the label is setable
>> and
>> fetchable.
>
> This bug is fixed in the latest ImageJ daily build (1.52b20).
>
> -wayne
>
>> I believe that this may be the cause of (new
>> ImageCalculator()).run(String,ImagePlus,ImagePlus) and/or
>> IJ.run(ImagePlus,math operations, options) to remove the slice labels when
>> one
>> of the parameters is a hypertack with ns==1 and nf==1; as this is happening
>> and given the aforementioned bug.
>>
>> Thanks,
>>
>> Fred
>>
>> PS: https://imagej.nih.gov/ is not responding...
>>
>> import ij.*;
>> import ij.process.*;
>> import ij.gui.*;
>> import java.awt.*;
>> import ij.plugin.*;
>> import ij.plugin.frame.*;
>>
>> public class My_Plugin implements PlugIn {
>>
>>   public void run(String arg) {
>>      int ns=1,nf=1;
>>      ImagePlus imp = IJ.createImage("A", "32-bit grayscale-mode", 128, 128,
>> 1, ns, nf);
>>
>>      imp.getStack().setSliceLabel("imp label",1);
>>      IJ.log("A="+imp.getStack().getSliceLabel(1));
>>      }
>>
>> }
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html