questions on image annotations (SvgConstraint)

63 views
Skip to first unread message

Vladimir Alexiev

unread,
Mar 12, 2012, 6:45:06 AM3/12/12
to oac-d...@googlegroups.com

Hi!

We started implementing image annotations in ResearchSpace, and we’ll use OAC.

 

The basic model is clear

<annot> a oac:Annotation;

  oac:hasBody <annot/body>;

  oac:hasTarget <annot/target>.

<annot/target> a oac:ConstrainedTarget;

  oac:constrainedBy <annot/constraint>;

  oac:constrains <http://www.researchspace.org/Rembrandt/images/DT219363.jpg>.

<annot/constraint> oac:SvgConstraint, cnt:ContentAsText;

  dc:format "SVG";

  cnt:chars """<polyline points="10,20 15,25 25,10 10,20"/>"""...

image-annotation-example.png

But I have some questions on more specialized topics

<svg> element

The OAC spec says "should be a single SVG element, not an entire SVG canvas" so it seems an implicit <svg> tag is assumed around the SVG data.
Is this the case? It would make “View Configuration” below harder L

View Configuration

Concept of "Currently selected annotation" so that:

  • When the user Replies, the reply is attached to the current annotation
  • When the user selects an annotation, the image view is set so that the annotation is fully visible

There are two alternatives to accomplish the latter:

  1. Set the view to the bounding box of the annotated region
  2. Restore the view to what it was when the annotation was created or last edited.
    This is better since the user may want to see more than the annotated region, and if the same view was shared by several annotations then the view won't "jump"
    • The screens of two users may be different, so the available image area may be different (including different aspect ratios).
      We have decided to keep fixed: center of image area, aspect ratio, zoom level; while allowing the image fringes to be cropped

How can we represent this? Considerations:

  • Use the viewBox attribute that is available on svg, symbol, image
  • Use the preserveAspectRatio attribute that is available on svg, symbol, image, marker, view
    This should keep center and aspect ratio fixed, but the zoom still may vary

preserveAspectRatio="XMidYMid slice"

  • <svg> provides attributes to specify the canvas area:

width="4in" height="2in" viewBox="0 0 4000 2000"

  • SVG Linking describes a number of options to link to a particular area of an SVG canvas
  • for a deep zoom image, the IIP URL specifies the zoom level and tile origin. IIP represents the zoom level as log2 (eg 5 means 2^5=32), but we should represent it as a real number to accommodate smooth zoom in the future

 

Markers                     

A marker (point, pin) is a point carrying a particular symbol (shape).
OAC does not support markers, since an image annotation target is represented as an oac:SvgConstraint, which consists of an SVG shape: path, rect, circle, ellipse, line, polyline, polygon, g(roup) (eg used to create a region with a hole).

A ResearchSpace requirement is to allow markers as annotation targets

  • A marker is characterized by:
    • Point (coordinates)
    • Symbol (marker type or shape)
      • Can be any geometry or image
      • Should not scale with image zoom (should remain constant in size)
      • RS3.3 will support a small circle and a pin (as on Google Maps)
  • It could also be useful to support multi-markers consisting of several points, where the symbol is fixed

SVG does not have the concept of a standalone point/marker, but there are several alternatives (below).
Do you think such extension is useful, and how would you represent it?

1. Use-Symbol

Represent the point as use and the shape as a symbol

  • "use" carries x,y,width,height
  • "symbol" carries the shape geometry or image
  • pro: supports constant size through explicit width,height
  • cons: doesn't support multi-markers
  • cons: requires <svg><defs> while it's unclear whether OAC supports <svg>

<svg>

  <defs> <symbol id="Triangle"> <polyline points="0,0 10,5 0,10 0,0" /> </symbol> </defs>

  <use x="1000" y="750" width="10" height="10" xlink:href="#Triangle" />

</svg>

  • if the symbol contains a single graphics element, then <symbol> can be skipped:

<svg>

  <defs> <polyline id="Triangle" points="0,0 10,5 0,10 0,0" /> </defs>

  <use x="1000" y="750" width="10" height="10" xlink:href="#Triangle" />

</svg>

2. Polyline-Marker

Represent the point as polyline and the shape as marker

  • Markers are styling elements (symbols) "attached to one or more vertices of ‘path’, ‘line’, ‘polyline’ and ‘polygon’ elements"
    • the marker carries markerWidth,markerHeight
    • use markerUnits="userSpaceOnUse" so the marker size is absolute (the default markerUnits="strokeWidth" scales the marker according to the path's stroke)
    • use the default orient="0" so the marker has absolute orientation (orient="auto" rotates the marker along the path's tangent)
  • A single point can be represented as a singular (degenerate) polyline; a multi-marker as a polyline with no stroke
  • pro: supports multi-markers
  • cons: requires <svg><defs> while it's unclear whether OAC supports <svg>

<svg>

  <defs> <marker id="Triangle"> <polyline points="0,0 10,5 0,10 0,0" /> </marker> </defs>

  <polyline points="1000,750" marker="url(#Triangle)" />

</svg>

3. Class "marker"

Use a normal graphics element (shape or image), signify it as a marker using class

  • cons: to achieve constant size, requires a transform or manual size recalculation
  • cons: does not support multi-markers
  • pro: does not require <svg><defs>

<polyline points="0,0 10,5 0,10 0,0" class="marker" />

 

image003.jpg

Vladimir Alexiev

unread,
Mar 12, 2012, 10:32:56 AM3/12/12
to oac-d...@googlegroups.com, vlad...@sirma.bg
Re "View Configuration": if the <svg> element is not part of oac:SvgConstraint, then I think we'll use an Image Fragment, eg 
   <annot/target> oac:constrains
     <http://www.researchspace.org/Rembrandt/images/DT219363.tif#xywh=1000,1000,2000,2000>.
  <http://www.researchspace.org/Rembrandt/images/DT219363.tif#xywh=1000,1000,2000,2000> dcterms:isPartOf
    <http://www.researchspace.org/Rembrandt/images/DT219363.tif>.

This should work even for huge (deep-zoom) images, since the software can compute the required zoom level from the fragment area

Robert Sanderson

unread,
Mar 12, 2012, 11:34:04 AM3/12/12
to oac-d...@googlegroups.com
On Mon, Mar 12, 2012 at 4:45 AM, Vladimir Alexiev <vlad...@sirma.bg> wrote:
> We started implementing image annotations in ResearchSpace, and we’ll use OAC.

That's great :)

> But I have some questions on more specialized topics
> <svg> element
> The OAC spec says "should be a single SVG element, not an entire SVG canvas" so it seems an implicit <svg> tag is assumed around the SVG data.
> Is this the case? It would make “View Configuration” below harder

Yes.  The reason for this is to avoid the situation where the SVG
canvas size, the viewport and the dimensions of the resource being
annotated don't match up.
It also allows the client to have a single canvas on to which the SVG
elements are drawn, or to more easily convert the SVG into its own
local drawing framework.


> View Configuration


> When the user selects an annotation, the image view is set so that the annotation is fully visible

> Restore the view to what it was when the annotation was created or last edited.
> This is better since the user may want to see more than the annotated region, and if the same view was shared by several annotations then the view won't "jump"
> The screens of two users may be different, so the available image area may be different (including different aspect ratios).
> We have decided to keep fixed: center of image area, aspect ratio, zoom level; while allowing the image fringes to be cropped
> How can we represent this?

We consider this level of UI information to be outside the scope of
OAC. Interoperability at this level would be very difficult given
different platforms, clients, target media types, etc. etc.

However see below...

> Markers
> A marker (point, pin) is a point carrying a particular symbol (shape).

Yes, at the moment we don't support these as they're a function of the
user interface. Even the color of the target segment isn't explicit
in the model as it stands.
We have an agenda item to discuss the use of CSS to provide UI styling
hints during a meeting at the end of this week, which I believe would
cover your use cases.
In this scenario the target is not the marker, the target would be a
point. Then the CSS would associate a marker image (or color, or text
styling, or ...) with the point.

I've not replied to either your or Bernhard's messages about the
machine oriented annotations, as these are the first and most
important topic on the agenda at the meeting. We'll report back next
week, and apologies for the delays :)

Hope that helps!

Rob

Vladimir Alexiev

unread,
Mar 26, 2012, 4:11:11 AM3/26/12
to oac-d...@googlegroups.com
Rob, thanks for the reply!

> > implicit <svg> tag is assumed around the SVG data.

> > View Configuration


> We consider this level of UI information to be outside the scope

Ok then, so we'll represent this with an Image Fragment as per my prev
email. A better example:

<DT219363.tif/annot/1/target> a oac:ConstrainedTarget;
oac:constrainedBy <DT219363.tif/annot/1/constraint>;
oac:constrains <DT219363.tif#xywh=1000,900,250,250>.
<DT219363.tif#xywh=1000,900,250,250> dcterms:isPartOf <DT219363.tif>.

> In this scenario the target is not the marker, the target would be a
> point

BUT how do you represent a single point (or multi-points) in SVG?
I outlined 3 alternatives in my first email.


Reply all
Reply to author
Forward
0 new messages