[ome-users] Struggling with augmented XML output from OME
Josiah Johnston
siah at nih.gov
Mon Sep 19 19:39:48 BST 2005
Can you please move this conversation to the ome-devel list
<ome-devel at lists.openmicroscopy.org.uk> and attach the modified files
(working through diffs is painful).
This is more developer work than user land work, and we have a list
dedicated to such traffic. Broadcasting developer traffic here is a
minor abuse of the listserve.
Thanks,
Josiah
On Sep 19, 2005, at 12:36 PM, Graham Klyne wrote:
> Following recent messages, I've made my attempt to obtain augmented XML
> output from OME, but so far I'm hitting a brick wall.
>
> Here's what I did so far:
>
>
> (1) edited
> /usr/lib/perl5/site_perl/5.8.5/OME/Web/DefaultMenuBuilkder.pm
> to contain this:
> [[
> # ** Images **
> {
> web_class => 'OME::Web::XMLFileExport',
> type => 'link',
> text => undef,
> },
> {
> web_class => 'OME::Web::XMLFileExportDTGED',
> type => 'link',
> text => undef,
> },
> ]]
>
>
> (2) created
> /usr/lib/perl5/site_perl/5.8.5/OME/Web/XMLFileExportDTGED.pm, based on
> XMLFileExport.pm, but with the following changes:
> [[
> [root at helenome src]# diff
> /usr/lib/perl5/site_perl/5.8.5/OME/Web/XMLFileExportDTGED.pm
> /usr/lib/perl5/site_perl/5.8.5/OME/Web/XMLFileExport.pm
> 1c1
> < # OME/Web/XMLFileExportDTGED.pm
> ---
>> # OME/Web/XMLFileExport.pm
> 38c38
> < package OME::Web::XMLFileExportDTGED ;
> ---
>> package OME::Web::XMLFileExport ;
> 54c54
> < return "Open Microscopy Environment - Export OME XML + DTGED
> data" ;
> ---
>> return "Open Microscopy Environment - Export OME XML to
>> browser" ;
> 58,59c58
> < ###CHANGED:
> < my $menu_text = "Export debug DTGED Image(s)";
> ---
>> my $menu_text = "Export Image(s)";
> 95,97c94,95
> < ###CHANGED:
> < my $exporter=
> OME::Web::XMLFileExportDTGED->new($session);
> <
> $exporter->exportDTGEDToXMLFile(\@images,$filename);
> ---
>> my $exporter=
> OME::Tasks::OMEXMLImportExport->new($session);
>> $exporter->exportToXMLFile(\@images,$filename);
> 121,122c119
> < ###CHANGED:
> < my $tmpl = HTML::Template->new( filename =>
> 'XMLFileExportDTGED.tmpl', path => $tmpl_dir );
> ---
>> my $tmpl = HTML::Template->new( filename =>
> 'XMLFileExport.tmpl', path => $tmpl_dir );
> 130,131c127
> < ###CHANGED:
> < $cgi->startform( -action => $self->pageURL(
> 'OME::Web::XMLFileExportDTGED' ) ).
> ---
>> $cgi->startform( -action => $self->pageURL(
> 'OME::Web::XMLFileExport' ) ).
> 139,201d134
> <
> < #####################################################
> < # For each given image, exports all attributes from the
> < # image import MEX to the specified XML file.
> < # export($images,$file)
> < # $images a ref to an array containing the image objects
> < # $file MUST be absolute (path+name)
> <
> < sub exportDTGEDToXMLFile {
> <
> < my ($self, $images, $file) = @_ ;
> < my $session = OME::Session->instance();
> < my $factory = $session->Factory() ;
> <
> < # To-do check if can write in file
> < my $exporter = OME::Tasks::OMEExport->new( session => $session
> ) ;
> < my @exportObjects = () ;
> < my $image_import_module =
> $session->Configuration()->image_import_module();
> < ###NEW:
> < my $annotation_module =
> $session->Configuration()->annotation_module();
> < my @outputs = $image_import_module->outputs();
> < foreach my $image (@$images) {
> < push(@exportObjects,$image) ; # Add the image
> <
> < # Get the import mex for this image
> < my $import_MEX = $factory->findObject
> ("OME::ModuleExecution",
> < image_id => $image->id(),
> < module => $image_import_module,
> < );
> <
> < ###NEW...
> < # Get the DTGED annotation mex for this image
> < my $dtged_MEX = $factory->findObject
> ("OME::ModuleExecution",
> < image_id => $image->id(),
> < module => $annotation_module
> < );
> < ### I guess this selects all annotations for the image;
> < ### how do I restrict additional results to those with
> Untyped Oputput
> < ### of the form/semantic type defined as
> "DTGEDImageAnnotation" ?
> < ###
> <
> < # Collect all the attributes produced by the import MEX
> < my @untyped_outputs = $import_MEX->untypedOutputs();
> < ###NEW:
> < my @dtged_outputs = $dtged_MEX->untypedOutputs();
> < ###CHANGED:
> < ### foreach my $output
> (@outputs, at untyped_outputs, at dtged_outputs) {
> < foreach my $output (@untyped_outputs, at dtged_outputs) {
> < my $ST = $output->semantic_type();
> < next unless $ST; # Skip the untyped output
> itself
> <
> < # Get the output's attributes, and push them on
> the list
> < my $attributes =
> OME::Tasks::ModuleExecutionManager->
> < getAttributesForMEX($import_MEX,$ST);
> < push(@exportObjects,@$attributes);
> < }
> <
> < }
> < $exporter->buildDOM(\@exportObjects, ResolveAllRefs => 1,
> ExportSTDs => 0) ;
> < $exporter->exportFile($file);
> < return ;
> < }
> <
> ]]
>
>
> (3) Created /OME/html/Templates/XMLFileExportDTGED.tmpl from
> /OME/html/Templates/XMLFileExport.tmpl, thus:
> [[
> [root at helenome src]# diff /OME/html/Templates/XMLFileExportDTGED.tmpl
> /OME/html/Templates/XMLFileExport.tmpl
> 7c7
> < <h2>Export Images to OME XML with DTGED data</h2>
> ---
>> <h2>Export Images to OME XML</h2>
> ]]
>
> ...
>
> The new left-menu entry is displayed as expected, and it does indeed
> invoke the new code. But whatever changes I make to the new function
> exportDTGEDToXMLFile, the result of exporting DTGED file data is
> exactly
> the same as fromn performing a normal export ofnthe same file.
>
> I have ensured that the new function is actually being called (by
> inserting a die clause in the new routine, and observing the system
> error displayed when attempting to export DTGED data).
>
> I have also tried removing the line:
> push(@exportObjects,$image) ; # Add the image
> so I can get the metadata without image data, but still no change in
> the
> result data.
>
> I can't find any place other than that I've replaced where function
> exportToXMLFile is called.
>
> So, as far as I can tell, I am doing all the appropriate things, but
> whatever changes I make to the new export function, the output I get
> sent back to my browser is unchanged.
>
> Any pointers, please?
>
> #g
>
> --
> Graham Klyne
> Image Bioinformatics Research Group (http://www.bioimage.org/)
> Department of Zoology, University of Oxford
> South Parks Road, Oxford OX1 3PS, UK
> E-mail: <Graham.Klyne at zoo.ox.ac.uk>
> Direct phone: +44-(0)1865-281991
> Departmental fax: +44-(0)1865-310447
> _______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>
More information about the ome-users
mailing list