HandleExtraFileTypes does not preserve subtitle "Label" property

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

HandleExtraFileTypes does not preserve subtitle "Label" property

Alan Brooks
While implementing a custom reader that extends ImagePlus, I was trying to set the "Label" property (via imp.setProperty("Label")) so that the subtitle shows up nicely in ImageJ.

When I call my custom file format reader plugin directly from File>Import>My Custom File..., the Label property is shown in the ImageWindow's subtitle.

However, when I integrate my reader into HandleExtraFileTypes.java, the Label property is not shown in the ImageWindow's subtitle for images opened by File>Open... or by drag and drop.

I was able to fix this by inserting the following code to preserves "Label" property in the HandleExtraFileTypes.run() method, as follows:

// also copy the subtitle ("Label") field over if it exists
if (imp.getProperty("Label") != null)
    setProperty("Label", imp.getProperty("Label"));

I am not sure how to locate the canonical HandleExtraFileTypes.java. There seems to be one hosted on the ImageJ1 plugin server (source). I do not see one on the ImageJ1 git mirror. Perhaps the version in the ij1-installer project is canonical?

Anyway, I am not sure where or how to submit a patch, so I am just posting to this mailing list. Let me know if there is a better place.

For use at my company, customizing HandleExtraFileTypes is ok. But I figure it would be get to get this fix to other users if possible.

Note I only tested this with ImageJ1, version 1.49p.
Reply | Threaded
Open this post in threaded view
|

Re: HandleExtraFileTypes does not preserve subtitle "Label" property

ctrueden
Hi Alan,

> I am not sure how to locate the canonical HandleExtraFileTypes.java.

One option for your bug-fix in the immediate term is to a file a PR against
the HandleExtraFileTypes in fiji/IO [1]. This is the version that is
distributed with Fiji.

> I figure it would be get to get this fix to other users if possible.

The more future-proof, but also more bleeding-edge, option is to create a
SCIFIO format reader [2].

Regards,
Curtis

[1]
https://github.com/fiji/IO/blob/master/src/main/java/HandleExtraFileTypes.java
[2] https://github.com/scifio/scifio/wiki/Adding-support-for-an-image-format

On Fri, Mar 13, 2015 at 3:34 PM, Alan Brooks <[hidden email]> wrote:

> While implementing a custom reader that extends ImagePlus, I was trying to
> set the "Label" property (via imp.setProperty("Label")) so that the
> subtitle
> shows up nicely in ImageJ.
>
> When I call my custom file format reader plugin directly from
> File>Import>My
> Custom File..., the Label property is shown in the ImageWindow's subtitle.
>
> However, when I integrate my reader into HandleExtraFileTypes.java, the
> Label property is not shown in the ImageWindow's subtitle for images opened
> by File>Open... or by drag and drop.
>
> I was able to fix this by inserting the following code to preserves "Label"
> property in the HandleExtraFileTypes.run() method, as follows:
>
>
>
> I am not sure how to locate the canonical HandleExtraFileTypes.java. There
> seems to be one hosted on the  ImageJ1 plugin server
> <http://rsb.info.nih.gov/ij/plugins/file-handler.html>   ( source
> <http://rsb.info.nih.gov/ij/plugins/download/HandleExtraFileTypes.java>
> ).
> I do not see one on the  ImageJ1 git mirror
> <
> https://github.com/imagej/imagej1/search?utf8=%E2%9C%93&q=HandleExtraFileTypes
> >
> . Perhaps the  version in the ij1-installer project
> <
> https://github.com/imagej/ij1-installer/blob/3a1cd0cc3c6754cdce5776313a05374e552977e0/app/plugins/Input-Output/HandleExtraFileTypes.java
> >
> is canonical?
>
> Anyway, I am not sure where or how to submit a patch, so I am just posting
> to this mailing list. Let me know if there is a better place.
>
> For use at my company, customizing HandleExtraFileTypes is ok. But I figure
> it would be get to get this fix to other users if possible.
>
> Note I only tested this with ImageJ1, version 1.49p.
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/HandleExtraFileTypes-does-not-preserve-subtitle-Label-property-tp5011960.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: HandleExtraFileTypes does not preserve subtitle "Label" property

Alan Brooks
Pull request created against fiji-IO.

I would like to make this a SCIFIO reader, but at the moment our organization still uses ImageJ1 in a pretty wide-spread way.

Alan
Reply | Threaded
Open this post in threaded view
|

Re: HandleExtraFileTypes does not preserve subtitle "Label" property

Alan Brooks
For the record, I also made a pull request against ij1-installer.

Out of curiosity, how would one set and store metadata such as the image window subtitle (stored by ImageJ1 in the "Label" property) and detailed metadata (stored by ImageJ1 in the "Info" property) in the ImageJ2/Fiji data model?

Alan
Reply | Threaded
Open this post in threaded view
|

Re: HandleExtraFileTypes does not preserve subtitle "Label" property

ctrueden
Hi Alan,

> For the record, I also made a  pull request against ij1-installer.

Thank you!

> Out of curiosity, how would one set and store metadata such as the
> image window subtitle (stored by ImageJ1 in the "Label" property) and
> detailed metadata (stored by ImageJ1 in the "Info" property) in the
> ImageJ2/Fiji data model?

Detailed "info-style" metadata is stored in the table returned by
net.imagej.ImgPlus#getProperties(); see [1]. But that API is still evolving
and will undergo another major design iteration soon. There is currently no
dedicated "label" field, but should be; I filed an issue for it [2].

Regards,
Curtis

[1] http://javadoc.imagej.net/ImageJ/net/imagej/ImgPlus.html#getProperties()
[2] https://github.com/imagej/imagej-common/issues/47

On Mon, Mar 16, 2015 at 3:25 PM, Alan Brooks <[hidden email]> wrote:

> For the record, I also made a  pull request
> <https://github.com/imagej/ij1-installer/pull/4>   against  ij1-installer.
> <https://github.com/imagej/ij1-installer>
>
> Out of curiosity, how would one set and store metadata such as the image
> window subtitle (stored by ImageJ1 in the "Label" property) and detailed
> metadata (stored by ImageJ1 in the "Info" property) in the ImageJ2/Fiji
> data
> model?
>
> Alan
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/HandleExtraFileTypes-does-not-preserve-subtitle-Label-property-tp5011960p5012003.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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