Skip to main content

Read and transform LJPEG images

Project description

ReadTheDocs Project generated with PyScaffold

ljpeg

Read and transform LJPEG images into modern formats.

Warning: You must have installed flex on your operating system.

Convert to TIFF (requires the .ics file in the same directory as LJPEG):

ljpeg $(pwd)/C_0029_1.LEFT_CC.LJPEG $(pwd)/output.tiff

Convert to TIFF and verify that no information has been lost:

ljpeg $(pwd)/C_0029_1.LEFT_CC.LJPEG $(pwd)/output.tiff --verify

Convert to jpeg for visualization with down-sizing scale=0.3 (16-bit TIFF is not good for direct visualization):

ljpeg $(pwd)/C_0029_1.LEFT_CC.LJPEG $(pwd)/output.jpg --visual --scale 0.3

Note that output file can be any format that’s supported by OpenCV (which includes all common types). Most file formats only support 8-bit images, so directly saving into such file formats will cause problems. Add “–visual” to normalize color into 8-bit before saving to such file formats.

The Stanford ljpeg code is in public domain and is therefore OK to be included here. I did minor modification to make the code compile under modern Linux.

Getting started

Download a set of mammograms with:

wget -q ftp://figment.csee.usf.edu:21/pub/DDSM/cases/normals/normal_08/case4606/ && cat index.html | grep -oP '"ftp.*"' | sed s/\"//g | parallel wget

Transform a lot of mammograms parallely:

find "$(pwd)" -type f -name '*.LJPEG' | parallel -j+0 "ljpeg {} $(pwd)/{/.}.tiff --verify"

Making Changes & Contributing

This project uses pre-commit, please make sure to install it before making any changes:

pip install pre-commit
cd demo-project
pre-commit install

It is a good idea to update the hooks to the latest version:

pre-commit autoupdate

Don’t forget to tell your contributors to also install and use pre-commit.

Note

This project has been set up using PyScaffold 4.2.2.post1.dev3+g01e6e81. For details and usage information on PyScaffold see https://pyscaffold.org/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ljpeg-3.6.11.tar.gz (628.1 kB view details)

Uploaded Source

Built Distribution

ljpeg-3.6.11-py3-none-any.whl (626.5 kB view details)

Uploaded Python 3

File details

Details for the file ljpeg-3.6.11.tar.gz.

File metadata

  • Download URL: ljpeg-3.6.11.tar.gz
  • Upload date:
  • Size: 628.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for ljpeg-3.6.11.tar.gz
Algorithm Hash digest
SHA256 a60c9d36a6289241101ebbd3643b2d5f485b911898610e3bbc2996d2a7cf8172
MD5 4ffc81c1a9c82d5695bb746197dfd683
BLAKE2b-256 595648298c1fea75038d739c4a8a2191b1f60b3cd0db509018832f899ba03053

See more details on using hashes here.

File details

Details for the file ljpeg-3.6.11-py3-none-any.whl.

File metadata

  • Download URL: ljpeg-3.6.11-py3-none-any.whl
  • Upload date:
  • Size: 626.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for ljpeg-3.6.11-py3-none-any.whl
Algorithm Hash digest
SHA256 9508fc2f09cca978c66c0f0ec3b652d53f7c4dc864fd5a2232e7c1c25f16a156
MD5 fd236f4c2623bb16269f14b93eff67d1
BLAKE2b-256 32279b4ea68b3d1a2161cfa2034219042148797e322f60967ffa00e669ca350c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page