compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (23)

View Page History
Image Annotation Design
{toc}
h1. OAC Representation
-- [oac:SvgConstraint|http://www.openannotation.org/spec/beta/constraints.html#DM_Serialization] to represent the annotated region
-- 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:
{code:xml}
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
...
</svg>
{code}
{code:xml}<svg version="1.1" xmlns="http://www.w3.org/2000/svg">...</svg>{code}
-- We use an [Image Fragment|http://www.openannotation.org/spec/beta/#DM_Frag_Media] (#xywh) to associate a [#View Configuration] with the annotation.
-- The SvgConstraint is given in absolute image coordinates, even for deep-zoom images, no matter what the View Configuration is
- the body is an oac:Body and includes the same properties as for [Data Annotation|Open Annotation Collaboration#RS Data Annotation in OAC]
-- if a reply is made, it is attached to the same oac:ConstrainedTarget and has a link rso:reply_to pointing to the original annotation
We start with an example of the basic case, then treat some special requirements.
{code}
@base <http://www.researchspace.org/Rembrandt/images/>.
@prefix oac: <http://www.openannotation.org/ns/>. # Open Annotation Collaboration
@prefix dcterms: <http://purl.org/dc/terms/>. # Dublin Core Terms
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>. # XML Schema Datatypes

<DT219363.tif/annot/1> a oac:Annotation;
oac:hasBody <DT219363.tif/annot/1/body>;
oac:hasTarget <DT219363.tif/annot/1/target>.
<DT219363.tif/annot/1/target> a oac:ConstrainedTarget;
oac:constrainedBy <DT219363.tif/annot/1/constraint>;
oac:constrains <http://www.researchspace.org/Rembrandt/images/DT219363.jpg>. <DT219363.tif#xywh=1000,900,250,250>.
<DT219363.tif#xywh=1000,900,250,250> dcterms:isPartOf <DT219363.tif>.
<DT219363.tif/annot/1/constraint> a oac:SvgConstraint, cnt:ContentAsText;
dc:format "SVG";
cnt:chars """<polyline points="10,20 15,25 25,10 10,20"/>""". points="1125,1025 1150,1025 1135,1050 1125,1025"/>""".
<DT219363.tif/annot/1/body> a oac:Body;
rso:P2_annotation_category rst-annotation-category:observation;
rso:P3_has_title "The nose is large and wrinkled";
dcterms:creator rs-users:VladimirAlexiev;
h1. Special Requirements

h2. View Configuration
Image annotations can be checked/unchecked (made visible/invisible). But we also need a 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:
# *Bounding Box*: set the view to the bounding box of the annotated region, thus maximizing it
# (current decision) *Saved View*: set 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 (eg more annotations or something outside of the region)
#- If the same view was shared by several annotations then the view won't "jump"

Alternatives/considerations:
- (current decision) Use [Image Fragment|http://www.openannotation.org/spec/beta/#DM_Frag_Media] (#xywh) to select the view area.
-- This should work even for deep-zoom images, since we can compute the required zoom level from the fragment area
-- If we need to save the zoom level, we should represent it as a real number to accommodate smooth zoom in the future, although IIP represents the zoom level as log2 (eg 5 means 2^5=32)
-- Depending on [answer from OAC mlist|https://groups.google.com/forum/?fromgroups#!topic/oac-discuss/VEJrBFJAvks] we may decide to store the view configuration in a different way
- Could use [viewBox|http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute] attribute [that is available|http://www.w3.org/TR/SVG/coords.html#ElementsThatEstablishViewports] on svg, symbol, image
-- Could specify the <svg> canvas area to include the complete image, then view part of it:
{code:xml}width="2000" height="2000" viewBox="1000 900 250 250"{code}
- could use
transform="translate(1000,900) scale(5)"
- Could use [preserveAspectRatio|http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute] attribute that is available on svg, symbol, image, marker, view.
-- The screens of two users may be different, so the available image area may be different (including different aspect ratios).
To preserve center of image area, aspect ratio, zoom level; while allowing the image fringes to be cropped, maybe this can help:
{code:xml}preserveAspectRatio="XMidYMid slice"{code}
- [SVG Linking|http://www.w3.org/TR/SVG/linking.html#SVGFragmentIdentifiers] describes a number of options to link to a particular area of an SVG canvas

h2. Markers
A marker (point, pin) is a point carrying a particular symbol (shape).
<svg>
<defs> <symbol id="Triangle"> <polyline points="0,0 10,5 0,10 0,0" /> </symbol> </defs>
<use x="1000" y="750" x="1125" y="1025" width="10" height="10" xlink:href="#Triangle" />
</svg>
{code}
<svg>
<defs> <polyline id="Triangle" points="0,0 10,5 0,10 0,0" /> </defs>
<use x="1000" y="750" x="1125" y="1025" width="10" height="10" xlink:href="#Triangle" />
</svg>
{code}
<svg>
<defs> <marker id="Triangle"> <polyline points="0,0 10,5 0,10 0,0" /> </marker> </defs>
<polyline points="1000,750" points="1125,1025" marker="url(#Triangle)" />
</svg>
{code}
- cons: does not support multi-markers
- pro: does not require <svg><defs>
{code:xml}<polyline points="0,0 10,5 0,10 0,0" transform="translate(1125,1025)" class="marker" />{code}

This is the current decision, but it's unclear whether it is optimal
- need to support deep zoom images
- possible changes in image format or server technology
Eg an image served by IIP and converted from TIF to JPG may have this URL ([Rembrandt data#Image URLs]):
- for a deep zoom image, the IIP URL specifies the zoom level and tile origin
- eg an image served by IIP and converted from TIF to JPG has URL like ([Rembrandt data#Image URLs]):
http://rembrandtdatabase.adlibsoft.com/IIPImageServer/IIPImageServer.exe?FIF=D:/rembrandtdatabase.adlibsoft.com/Images/mh0147_front_nl_2002.tif&HEI=300&CVT=JPEG

TODO TODO: not yet resolved

h2. View Configuration
Image annotations can be checked/unchecked (made visible/invisible). But we also need a 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:
# Set the view to the bounding box of the annotated region
# (current decision) 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

TODO TODO: not yet resolved.

Considerations:
- Use the [viewBox|http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute] attribute [that is available|http://www.w3.org/TR/SVG/coords.html#ElementsThatEstablishViewports] on svg, symbol, image
- Use the [preserveAspectRatio|http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute] attribute that is available on svg, symbol, image, marker, view
This should keep center and aspect ratio fixed, but the zoom still may vary
{code:xml}preserveAspectRatio="XMidYMid slice"{code}
- <svg> provides attributes to specify the canvas area:
{code:xml}width="4in" height="2in" viewBox="0 0 4000 2000"{code}
- [SVG Linking|http://www.w3.org/TR/SVG/linking.html#SVGFragmentIdentifiers] 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, so this also relates to the previous section
- 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
- Decide where to store the view configuration: best if it's in the SvgConstraint, depending on answer from OAC mlist

{tasklist}
Vlado: ask in OAC mailing list if an implicit <svg> tag is assumed around the SVG data