An extensible viewer for OCR-D workspaces
Reason this release was yanked:
Version is not 3.6 compatible, but doesn't require python>3.6. Use 0.5.1 for python3.6
Project description
OCR-D Browser
An extensible viewer for OCR-D mets.xml files
Screenshot
Features
- Browse fileGrps and pages, arranging views next to each other for comparison
- PageView: Show original or derived page images with PAGE-XML annotations overlay, similar to PageViewer
- ImageView: Show original or derived images (
AlternativeImage
on any level of the structural hierarchy) - ImageView: Show multiple images at once for different pages (horizontally) or different segments (vertically), zooming freely
- XmlView: Show raw PAGE-XML with syntax highlighting, open with PageViewer
- TextView: Show concatenated PAGE-XML text annotation
- DiffView: Show a simple diff comparison between text annotations from different fileGrps
- HtmlView: Show rendered HTML comparison from dinglehopper evaluations
Installation
Native (tested on Ubuntu 18.04/20.04)
The native installation requires GTK 3.
In any case you need a virtual environment with a current pip
version (>=20), preferably your existing OCR-D venv:
Create a current pip venv:
sudo apt install python3-pip python3-venv
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
From source
git clone https://github.com/hnesk/browse-ocrd.git
cd browse-ocrd
sudo make deps-ubuntu
make install
Via pip
sudo apt install libcairo2-dev libgirepository1.0-dev
pip install browse-ocrd
Docker
If you have installed Docker, you can build OCR-D Browser as a web service:
docker build -t ocrd_browser .
Or use a prebuilt image from Dockerhub:
docker pull hnesk/ocrd_browser
Usage
Native GUI
Start the app with the filesystem path to the METS file of your OCR-D workspace:
browse-ocrd ./path/to/mets.xml
You can still open another METS file from the UI though.
Docker service
When running the webservice, you need to pass a directory DATADIR
which (recursively) contains all the workspaces you want to serve.
The top entrypoint http://localhost/
will show an index page with a link http://localhost/browse/...
for each workspace path.
Each link will run browse-ocrd
at that workspace in the background, and then redirect your browser to the internal Broadway server, which renders the app in the web browser.
To start up, just do:
docker run -it --rm -v DATADIR:/data -p 8085:8085 -p 8080:8080 ocrd_browser
Configuration
Configuration file locations
At startup the following directories a searched for a config file named ocrd-browser.conf
# directories and their default values under Ubuntu 20.04
GLib.get_system_config_dirs() # '/etc/xdg/xdg-ubuntu/ocrd-browser.conf', '/etc/xdg/ocrd-browser.conf'
GLib.get_user_config_dir() # '/home/jk/.config/ocrd-browser.conf'
os.getcwd() # './ocrd-browser.conf'
Configuration file syntax
The ocrd-browser.conf
file is an ini-file with the following keys:
[FileGroups]
# Preferred fileGrp names for thumbnail display in the Page Browser
# Comma separated list of regular expressions
preferredImages = OCR-D-IMG, OCR-D-IMG.*, ORIGINAL
# Each Tool has a section header [Tool XYZ]
# At the moment the only defined tool is "PageViewer"
[Tool PageViewer]
# shell commandline to execute with placeholders
commandline = /usr/bin/java -jar /home/jk/bin/JPageViewer/JPageViewer.jar --resolve-dir {workspace.directory} {file.path.absolute}
The commandline
string will be used as a python format string with the keyword arguments:
workspace
: The currentocrd.Workspace
, all properties get shell escaped (byshlex.quote
) automatically.file
: The currentocrd_models.OcrdFile
, all properties get shell escaped (byshlex.quote
) automatically, also there is an additional propertypath
with the propertiesabsolute
andrelative
, so{file.path.absolute}
will be replaced by the shell quoted absolute path of the file.
Note: You can get PRImA's PageViewer at Github.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file browse-ocrd-0.5.2.1.tar.gz
.
File metadata
- Download URL: browse-ocrd-0.5.2.1.tar.gz
- Upload date:
- Size: 90.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.26.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cce0bde19c6cf11875be644e39c7a2f75adad33c314d4a8477c7622952004a2 |
|
MD5 | 93bf738f0c20d940c79d52368459fed7 |
|
BLAKE2b-256 | 218746ec83b4f88eaa4bebc89da3a58aa1898e7f4d6391d0b5dce1905f7c4785 |
File details
Details for the file browse_ocrd-0.5.2.1-py3-none-any.whl
.
File metadata
- Download URL: browse_ocrd-0.5.2.1-py3-none-any.whl
- Upload date:
- Size: 107.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.26.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fd248e9f73776ded66f4c207cb0fb4552b24367a5e0ed160af6b673f4202245 |
|
MD5 | 781cd09017db8f6bd807193bfa867165 |
|
BLAKE2b-256 | b5b6700658399ed4c534792f886690ed04b63f085e94e6da14a64b82e13acbe4 |