Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Quack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
commul
Zeit.shift
Quack
Commits
edf94fd4
Commit
edf94fd4
authored
11 years ago
by
Toke Eskildsen
Browse files
Options
Downloads
Patches
Plain Diff
Fixes #9 (no black/whiter overlays without ALTO)
parent
0d6b4c22
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
quack.sh
+33
-18
33 additions, 18 deletions
quack.sh
with
33 additions
and
18 deletions
quack.sh
+
33
−
18
View file @
edf94fd4
...
...
@@ -417,13 +417,37 @@ function processElements() {
IFS
=
$SAVEIFS
}
# Generates overlays
# src dest altofile
# Generates JavaScript snippet for black and white overlays
# Input: src
# Output: OVERLAYS (not terminated with ']')
function
blackWhite
()
{
local
SRC
=
"
$1
"
local
IMAGE_WIDTH
=
$2
local
IMAGE_HEIGHT
=
$3
local
REL_HEIGHT
=
`
echo
"scale=2;
$IMAGE_HEIGHT
/
$IMAGE_WIDTH
"
| bc
`
# Special overlays to show absolute black and absolute white pixels
# The FULL_REL is a hack as OpenSeaDragon scales with respect to width
OVERLAYS
=
"overlays: ["
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
{id: 'white',"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
x: 0.0, y: 0.0, width: 1.0, height:
$REL_HEIGHT
,"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
className: 'whiteoverlay'"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
},"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
{id: 'black',"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
x: 0.0, y: 0.0, width: 1.0, height:
$REL_HEIGHT
,"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
className: 'blackoverlay'"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
},"
$'
\n
'
}
# Generates overlayscase
# src dest altofile width height
# Output: ELEMENTS_HTML OVERLAYS OCR_CONTENT IDNEXT_CONTENT FULL_RELATIVE_HEIGHT
function
processALTO
()
{
local
SRC
=
$1
local
DEST
=
$2
local
ALTO_FILE
=
$3
local
SRC
=
"
$1
"
local
DEST
=
"
$2
"
local
ALTO_FILE
=
"
$3
"
local
IMAGE_WIDTH
=
$4
local
IMAGE_HEIGHT
=
$5
# local WIDTH=$4
# local HEIGHT=$5
...
...
@@ -433,10 +457,13 @@ function processALTO() {
OCR_CONTENT
=
""
local
ALTO
=
"
${
SRC_FOLDER
}
/
${
ALTO_FILE
}
"
blackWhite
"
$SRC
"
$IMAGE_WIDTH
$IMAGE_HEIGHT
# TODO: Extract relevant elements from the Alto for display
if
[
!
-f
$ALTO
]
;
then
# TODO: Better handling of non-existence
ELEMENTS_HTML
=
"<p class=
\"
warning
\"
>No ALTO file at
$ALTO
</p>"
$'
\n
'
# Terminate the black/white overlay and return
OVERLAYS
=
"
${
OVERLAYS
}
]"
return
fi
cp
"
$ALTO
"
"
$DEST
"
...
...
@@ -464,18 +491,6 @@ function processALTO() {
done
ELEMENTS_HTML
=
"
${
ELEMENTS_HTML
}
</table>"
$'
\n
'
# Special overlays to show absolute black and absolute white pixels
# The FULL_REL is a hack as OpenSeaDragon scales with respect to width
OVERLAYS
=
"overlays: ["
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
{id: 'white',"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
x: 0.0, y: 0.0, width: 1.0, height:
${
FULL_RELATIVE_HEIGHT
}
,"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
className: 'whiteoverlay'"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
},"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
{id: 'black',"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
x: 0.0, y: 0.0, width: 1.0, height:
${
FULL_RELATIVE_HEIGHT
}
,"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
className: 'blackoverlay'"
$'
\n
'
OVERLAYS
=
"
${
OVERLAYS
}
},"
$'
\n
'
OCR_CONTENT
=
""
IDNEXTS
=
""
IDPREVS
=
""
...
...
@@ -561,7 +576,7 @@ function makePreviewPage() {
echo
" -
${
P
##*/
}
"
local
ALTO_FILE
=
"
${
BASE
}${
ALTO_EXT
}
"
processALTO
"
$SRC_FOLDER
"
"
$DEST_FOLDER
"
"
$ALTO_FILE
"
processALTO
"
$SRC_FOLDER
"
"
$DEST_FOLDER
"
"
$ALTO_FILE
"
$IMAGE_WIDTH
$IMAGE_HEIGHT
# $IMAGE_WIDTH $IMAGE_HEIGHT
local
NAVIGATION
=
""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment