Package: browse-ocrd
OCR-D BrowserAn extensible viewer forOCR-Dmets.xmlfilesScreenshotFeaturesInstallationNativeFrom sourceVia pipDockerUsageNative GUIDocker serviceConfigurationConfiguration file locationsConfiguration file syntaxScreenshotFeaturesBrowse fileGrps and pages, arranging views next to each other for comparisonPageView: Show original or derived page images withPAGE-XMLannotations overlay, similar toPageViewerImageView: Show original or derived images (AlternativeImageon any level of the structural hierarchy)ImageView: Show multiple images at once for different pages (horizontally) or different segments (vertically), zooming freelyXmlView: Show rawPAGE-XMLwith syntax highlighting, open withPageViewerTextView: Show concatenatedPAGE-XMLtext annotationDiffView: Show a simple diff comparison between text annotations from different fileGrpsHtmlView: Show rendered HTML comparison fromdinglehopperevaluationsInstallationOCR-D Browser requires Python 3.7 or higher.Native (tested on Ubuntu 18.04/20.04)The native installation requiresGTK 3.In any case you need avirtual environmentwith a currentpipversion (>=20), preferably your existing OCR-D venv:Create a current pip venv:sudoaptinstallpython3-pippython3-venvpython3-mvenvvenvsourcevenv/bin/activate
pipinstall--upgradepipsetuptoolswheelFrom sourcegitclonehttps://github.com/hnesk/browse-ocrd.gitcdbrowse-ocrd
sudomakedeps-ubuntu
makeinstallVia pipsudoaptinstalllibcairo2-devlibgirepository1.0-dev
pipinstallbrowse-ocrdDockerIf you have installedDocker, you can build OCR-D Browser as aweb service:docker build -t ocrd_browser .Or use a prebuilt image from Dockerhub:docker pull hnesk/ocrd_browserUsageNative GUIStart the app with the filesystem path to the METS file of yourOCR-D workspace:browse-ocrd ./path/to/mets.xmlYou can still open another METS file from the UI though.Docker serviceWhen running the webservice, you need to pass a directoryDATADIRwhich (recursively) contains all the workspaces you want to serve.
The top entrypointhttp://localhost/will show an index page with a linkhttp://localhost/browse/...for each workspace path.
Each link will runbrowse-ocrdat that workspace in the background, and then redirect your browser to the internalBroadway 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_browserConfigurationConfiguration file locationsAt startup the following directories a searched for a config file namedocrd-browser.conf# directories and their default values under Ubuntu 20.04GLib.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 syntaxTheocrd-browser.conffile is an ini-file with the following sections and keys:[FileGroups]# Preferred fileGrp names for thumbnail display in the Page Browser# Comma separated list of regular expressionspreferredImages=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 placeholderscommandline=/usr/bin/java -jar /home/jk/bin/JPageViewer/JPageViewer.jar --resolve-dir {workspace.directory} {file.path.absolute}Note: You can get PRImA's PageViewer atGithub.Thecommandlinestring 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 propertypathwith the propertiesabsoluteandrelative, so{file.path.absolute}will be replaced by the shell quoted absolute path of the file.Configuration by environment variablesIt is possible to set or override values of the configuration through environment variables. The environment variables follow this structure :BROCRD__{SECTION}__{KEY}, whereSECTIONandKEYare in upper snake case and divided by a double underscore (__). If the section title contains spaces, the single words are also divided by__.Some examples:BROCRD__FILE_GROUPS__PREFERRED_IMAGES='THUMB'BROCRD__TOOL__PAGEVIEWER__COMMANDLINE='ls {file.path.absolute}'