Skip to main content

Read and write old Khoros/VisiQuest viff and xv formats

Project description

viff-xv

A viff or xv file is from Khoros/VisiQuest packages which has a header of 1024 bytes and is BSQ formated raw raster file. The file is parsed based upon the C struct definition provided in the source section.

Requirements

  • Python 3.7
  • numpy

Features and I/O

Read

data = viff.read(filename: str)

Write

viff.write(filename: str, data: np.array)

Variable Description

  • filenames (str) - Path to the input file to read
  • data (np.array) - data to save formated as np.array with dimensions [NumberOfImages,NumberOfBands,NumberOfColumns,NumberOfRows]

Code Example

Read and Display File

Read and display the first image and band of the read in file.

import viff
import matplotlib.pyplot as plt
import argparse

parser = argparse.ArgumentParser(description='viff reader example')
parser.add_argument('--file', type=str, help='filename (default=None)')
parser.add_argument('--save', action='store_true', help='save a copy as testing.xv')
args = parser.parse_args()

""" Read a file """
data = viff.read(args.file)

plt.imshow(data[0,0,:,:])
plt.show()

Write a new file

if args.save:
  """ Write a new file """
  viff.write('testing.xv',data)

Command line usage

$ python viff.py --file <filename> --save

This generates a plot and a new file 'testing.xv'.

Sources:

File Format

http://www.fileformat.info/format/viff/egff.htm

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

viffIO-0.0.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

viffIO-0.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file viffIO-0.0.1.tar.gz.

File metadata

  • Download URL: viffIO-0.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0.post20201103 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for viffIO-0.0.1.tar.gz
Algorithm Hash digest
SHA256 19c1c8da03291eedab93c9b38efdbeb06da7d98617100d307e74376e4c58a043
MD5 68f99ee1d40856dbe9262768dc6770a4
BLAKE2b-256 9a7cba983d740ce80fd439a2d7c650d142c64fd004fca0ba7be43a15147d0c12

See more details on using hashes here.

File details

Details for the file viffIO-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: viffIO-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0.post20201103 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for viffIO-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 555013621b52e7b076b9dc7baf03c0f759093359241b6f884df9d547dce22d8a
MD5 4aa638d5e6e8bc6f2f610d80c6483c33
BLAKE2b-256 6074dd7477b8ca413eed55f5d646cae74e2c5cf02b9f7a3cbb23eeb256a933a2

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