how to access the subtitle of images?

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

how to access the subtitle of images?

Oliver Bannach
Hi all,

I'd like to process several Tiffs, each coming along with a seperate
parameter file. These are simple text files containing the experimental
parameters. Is it possible to include some information from the
parameter file into the Tiff subtitle displayed above the image? Any
help is appreciated. Thanks.

regards
Oliver
Reply | Threaded
Open this post in threaded view
|

Re: how to access the subtitle of images?

Gluender
AFAIK it is not possible to write Image-Subtitles
by a IJ-macro (they are read only) but you can
use "ImageWindow.createSubtitle()".

You may however write metadata strings to
TIFF-Images by using the macro call
"setMetadata()". Please consult the manuals, the
IJ News page and the list archives.

>Hi all,
>
>I'd like to process several Tiffs, each coming
>along with a seperate parameter file. These are
>simple text files containing the experimental
>parameters. Is it possible to include some
>information from the parameter file into the
>Tiff subtitle displayed above the image? Any
>help is appreciated. Thanks.
>
>regards
>Oliver

HTH
--

Herbie
Reply | Threaded
Open this post in threaded view
|

Re: how to access the subtitle of images?

Wayne Rasband
In reply to this post by Oliver Bannach
> I'd like to process several Tiffs, each coming along with a  
> seperate parameter file. These are simple text files containing the  
> experimental parameters. Is it possible to include some information  
> from the parameter file into the Tiff subtitle displayed above the  
> image? Any help is appreciated. Thanks.

This macro opens a TIFF file and an associated text metadata file  
that has the same name and an extension defined by the variable  
'extension'. To display the metadata, press "i" (Image>Show Info).  
With ImageJ 1.40b and later, it adds the text between the 'before'  
and 'after' strings to the image subtitle. You can upgrade to v1.40b  
by using the Plugins>Utilities>Upgrade ImageJ command or by using the  
ImageJ_Updater plugin.

-wayne

   macro "Show Metadata [F1]" {
      extension = ".metadata";
      before ='MIPSS_Description", "';
      after = '")';
      open("");
      dir = getDirectory("image");
      name = getTitle;
      dotIndex = lastIndexOf(name, ".");
      if (dotIndex!=-1)
         name = substring(name, 0, dotIndex);
      name = name + extension;
      metadata = File.openAsString(dir+name);
      setMetadata(metadata);
      requires("1.40b"); // adds setMetadata("label",string)
      index1 = indexOf(metadata, before);
      if (index1==-1)
         exit(before + "not found in metadata");
      index1 += lengthOf(before);
      index2 = indexOf(metadata, after, index1);
      if (index2==-1)
         exit(after + " not found in metadata");
      setMetadata("label", substring(metadata, index1, index2));
   }