[ome-devel] adding woolz to bioformats

Melissa Linkert melissa at glencoesoftware.com
Fri Aug 23 18:37:10 BST 2013


Hi Bill,


On Thu, Aug 22, 2013 at 4:38 AM, Bill Hill <Bill.Hill at igmm.ed.ac.uk> wrote:

> Many thanks for all your help. I now have a Woolz reader/writer
> written which has all the Woolz stuff encapsulated in a service
> using a service factory. I've a few small bits to tidy up before
> I push it out my branch to an external git repository.
>
> *Q* I've not been able to find an example of reading a specific
> stage label, which following discussions here I'm using to record
> the origin of the Woolz object. I'm using this code to save the
> origin in WlzWriter.java:
>
>       CoreMetadata md = core.get(0);
>       MetadataStore store = makeFilterMetadata();
>       md.rgb = wlz.isRGB();
>       ...
>       store.setStageLabelName("**WoolzOrigin", 0);
>       store.setStageLabelX((double )(wlz.getOrgX()), 0);
>       store.setStageLabelY((double )(wlz.getOrgY()), 0);
>       store.setStageLabelZ((double )(wlz.getOrgZ()), 0);
>       MetadataTools.populatePixels(**store, this);
>
> In WlzReader.java I have:
>
>       MetadataRetrieve meta = getMetadataRetrieve();
>       MetadataTools.**verifyMinimumPopulated(meta, series);
>       wlz.open(id, "w");
>       int oX = 0; // HACK TODO use WoolzOrigin
>       int oY = 0; // HACK TODO use WoolzOrigin
>       int oZ = 0; // HACK TODO use WoolzOrigin
>       int nX = meta.getPixelsSizeX(series).**getValue().intValue();
>       ...
>       if(meta.**getPixelsPhysicalSizeX(0) != null) {
>         vX = meta.getPixelsPhysicalSizeX(0)**.getValue();
>       }
>       ...
>       int gType = FormatTools.**pixelTypeFromString(
>                   meta.getPixelsType(series).**toString());
>       wlz.setupWrite(oX, oY, oZ, nX, nY, nZ, nC, nT, vX, vY, vZ, gType);
>
> Is there example code anywhere of reading a specific stage label?
>
>
The stage label retrieval methods are analogous to the saving methods, so
something like this should work:

String stageLabelName = meta.getStageLabelName(0);
Double stageLabelX = meta.getStageLabelX(0);
Double stageLabelY = meta.getStageLabelY(0);
Double stageLabelZ = meta.getStageLabelZ(0);



> *Q* I'd like to save the Woolz object's background value, ie the image
> value assumed to hold for the rest of the universe outside of the
> Woolz object's domain. Any suggestions on the appropriate metadata
> options for this?
>
>
I can't think of a good place to put that at the moment - most likely we'd
need to add that to the schema.


> *Q* How should the service fail when there's no native library?
> At the moment I have:
>
>   bill at bill-lt% ./tools/showinf qwe.wlz
>   ...
>
>   Checking file format [Woolz]
>   Initializing reader
>   WlzReader initializing qwe.wlz
>   Exception in thread "main" loci.formats.**MissingLibraryException:
>   Woolz is required to read and write Woolz objects.
>   Please obtain the necessary JAR and native library files from:
>
> http://www.emouseatlas.org/**emap/analysis_tools_resources/**
> software/woolz.html<http://www.emouseatlas.org/emap/analysis_tools_resources/software/woolz.html>
> .
>   The source code for these is also available from:
>   https://github.com/ma-tech/**Woolz <https://github.com/ma-tech/Woolz>.
>         at
>   loci.formats.services.**WlzServiceImpl.open(**WlzServiceImpl.java:126)
>         at loci.formats.in.WlzReader.**initFile(WlzReader.java:111)
>         at loci.formats.FormatReader.**setId(FormatReader.java:1333)
>         at loci.formats.ImageReader.**setId(ImageReader.java:762)
>         at loci.formats.ReaderWrapper.**setId(ReaderWrapper.java:564)
>         at loci.formats.tools.ImageInfo.**testRead(ImageInfo.java:1017)
>         at loci.formats.tools.ImageInfo.**main(ImageInfo.java:1062)
>    Caused by: java.lang.**UnsatisfiedLinkError: no JWlz in
> java.library.path
>         at java.lang.ClassLoader.**loadLibrary(ClassLoader.java:**1734)
>         at java.lang.Runtime.**loadLibrary0(Runtime.java:823)
>         at java.lang.System.loadLibrary(**System.java:1028)
>         at uk.ac.mrc.hgu.Wlz.WlzBase.<**clinit>(WlzBase.java:46)
>         at
>   loci.formats.services.**WlzServiceImpl.open(**WlzServiceImpl.java:122)
>         ... 6 more


I would override the 'checkClassDependency(Class)' method in
AbstractService and have it throw MissingLibraryException, as you are now.
 checkClassDependency can then be called from the constructor and/or open
methods in your WlzServiceImpl (see for example
loci.formats.service.OMEXMLServiceImpl).

Regards,
-Melissa


>
> Cheers,
> Bill
> --
> Bill Hill                              : http://www.hgu.mrc.ac.uk
> MRC Human Genetics Unit                : http://www.emouseatlas.org
> MRC IGMM, University of Edinburgh      : Bill.Hill at igmm.ed.ac.uk
> Western General Hospital               : +44-131-3322471x2119
> Crewe Road, Edinburgh EH4 2XU, UK.     : +44-131-4678456
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> ______________________________**_________________
> ome-devel mailing list
> ome-devel at lists.**openmicroscopy.org.uk<ome-devel at lists.openmicroscopy.org.uk>
> http://lists.openmicroscopy.**org.uk/mailman/listinfo/ome-**devel<http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20130823/0fa55853/attachment.html>


More information about the ome-devel mailing list