wiki:TransformationServer
Last modified 12 years ago Last modified on 05/08/06 13:34:25

TransformationServer


Eider Moore


Overview

The Transformation Server is a simple web service that can transform coordinates and sets of coordinates efficiently and be tied in to complex systems of data sources.

It provides an interface with 3 basic functions:

  • double[] transform(String startSpace, String targetSpace, double[] coord) transforms a set of coordinates from space startSpace to targetSpace. coord must be divisible by 3 and the results appear in order. null signals an error.
  • double[] transformXYZ(String startSpace, String targetSpace, double x, double y, double z) transforms a single coordinate from startSpace to targetSpace. null signals an error.
  • String transformXML(String xml) transforms a set of points in the xml format specified below.

Currently available spaces

  • Magnet space for many patients, this is specified using the P number. So the magnet space for P143 is called "P143".
  • MNI is the name for the non-linear normalization generated by matlab.

Goals

  1. Provide a simple interface for transforming coordinates and eventually volumes.
  2. Make it easily callable from a Web Service enabled XQuery

Usage

The following calls are available:

  • port: TransformationWS
    • call: double[] transform(String, String, double[])
    • call: double[] transformXYZ(String, String, double, double, double)
    • call: String transformXML(String xml)

The wsdl lives at:

## == Bugs/Issues? ==

## == Documentation == ## javadoc...

Source Home

CVS

## == Compiling == ## If the code needs to be compiled, include instructions here

Configuration

There is a configuration file that specifies the external interfaces (like Web Service, or RMI) and the Transform Sources.

config.xml

Required Libraries

  1. matfile (part of MindSeer)
  2. vecmath.jar (part of Java3D)

## == Downloads == ## Compiled Version...

Example

XML Format

The Transformation Server simply acts as a "filter" for xml files. It expects transformable elements have the form: <AAA xS="#" yS="#" zS="#" spaceS="xxx" spaceT="yyy".../> where AAA, S and T are some strings specified in the param element. The default values are AAA="Coord", S="" and T="p"

The parameter element looks like: <TransformServerParam coord=AAA source=S target=T/> A file can have multiple param elements, but only one is active at a time.

The resulting elements look like: <AAA xS="#" yS="#" zS="#" xT="#" yT="#" zT="#" spaceS="xxx" spaceT="yyy".../> elements that could not be transformed are left unchanged.

Query

<?xml version="1.0" encoding="UTF-8"?>
<result>
   <TransformServerParam coord="Site" source="0" target=""/>
   <SiteSet>
      <Site z0="43.2242" y0="15.2846" space0="P40" x0="-61.117" space="MNI"/>
   </SiteSet>
   <SiteSet>
      <Site z0="8.84224" y0="10.0739" space0="P175" x0="-63.0056" space="MNI"/>
      <Site z0="" y0="" space0="P175" x0="" space="MNI"/>
      <Site z0="" y0="" space0="P175" x0="" space="MNI"/>
   </SiteSet>
   <SiteSet>
      <Site z0="-3.41681" y0="5.82331" space0="P176" x0="-55.183" space="MNI"/>
      <Site z0="16.3706" y0="-14.5631" space0="P176" x0="-56.8303" space="MNI"/>
      <Site z0="29.2965" y0="-3.11291" space0="P176" x0="-54.1749" space="MNI"/>
      <Site z0="29.3128" y0="25.4766" space0="P176" x0="-50.93" space="MNI"/>
   </SiteSet>
   <SiteSet>
      <Site z0="54.1727" y0="-22.2383" space0="P180" x0="-61.6022" space="MNI"/>
      <Site z0="39.0166" y0="43.4129" space0="P180" x0="-60.7196" space="MNI"/>
   </SiteSet>
</result>

Results

(With comments added)

<?xml version="1.0" encoding="UTF-8"?>
<result>
   <SiteSet>
      <!-- No result, this happened because the transform was missing-->
      <Site space="MNI" space0="P40" x0="-61.117" y0="15.2846" z0="43.2242"/>
   </SiteSet>
   <SiteSet>
      <Site space="MNI" space0="P175" 
            x="-68.60679111456197" x0="-63.0056" 
            y="-32.86716547248121" y0="10.0739"     
            z="-13.234578717088032" z0="8.84224"/>
      <!-- No result, we can see that x0, y0 and z0 are not well formed numbers -->
      <Site space="MNI" space0="P175" x0="" y0="" z0=""/>
      <Site space="MNI" space0="P175" x0="" y0="" z0=""/>
   </SiteSet>
   <SiteSet>
      <Site space="MNI" space0="P176" 
            x="-67.58274147783507" x0="-55.183" 
            y="-22.90874839761436" y0="5.82331" 
            z="-14.544820550231218" z0="-3.41681"/>
      <Site space="MNI" space0="P176" 
            x="-68.55109629091004" x0="-56.8303" 
            y="-39.47003478299405" y0="-14.5631" 
            z="13.16206175269939" z0="16.3706"/>
      <Site space="MNI" space0="P176" 
            x="-66.40935779142154" x0="-54.1749" 
            y="-26.490035940996393" y0="-3.11291" 
            z="26.917132021058052" z0="29.2965"/>
      <Site space="MNI" space0="P176" 
            x="-63.21571114060569" x0="-50.93" 
            y="2.0770550693861893" y0="25.4766" 
            z="23.886955954453846" z0="29.3128"/>
   </SiteSet>
   <SiteSet>
      <Site space="MNI" space0="P180" 
            x="-64.70538253518367" x0="-61.6022" 
            y="-50.57022981543601" y0="-22.2383" 
            z="32.82833817873621" z0="54.1727"/>
      <Site space="MNI" space0="P180" 
            x="-60.30387157469157" x0="-60.7196" 
            y="18.73370849025228" y0="43.4129" 
            z="12.731151590421875" z0="39.0166"/>
   </SiteSet> 
</result>

AngloSaxon

The Transformation Server can be integrated with xquery by using AngloSaxon. An example follows below.

Note that while using anglo:xquery is a little confusing for a generic call (the more proper way would be anglo:wscall(...) and then making that result a document with anglo:toDocument()), the documentation for anglo:xquery shows that this is guaranteed the correct result.

declare namespace anglo="java:edu.washington.biostr.sig.anglo.WebServiceWrapper";
let $result := anglo:xquery(
   "http://femur.biostr.washington.edu:8080/Transformer/wsdl/TransformationWS.wsdl",
   "TransformationWS", "transformXML", 
   '<q>
   <TransformServerParam coord="Site" source="0" target=""/>
   <SiteSet>
      <Site z0="-3.41681" y0="5.82331" space0="P176" x0="-55.183" space="MNI"/>
      <Site z0="16.3706" y0="-14.5631" space0="P176" x0="-56.8303" space="MNI"/>
   </SiteSet>
</q>')
return $result