Visionx V4 python package
Introduction
the python package to support the VisionX v4 image anlysis system is called v4. This package provides an interface bewteen the python programming language and the VisionX V4 image analysis system. When VisionX V4 is not installed on the system it provides some useful image analysis functions and facilitates the reading and writing of visionx images.
Installation
The VisionX V4 package is installed on the pypi repository and may typically be installed with pip; for example:
python3 -m pip install v4
Overview
The VisionX V4 package contains two modules, vx for image management and vd for image presentation. The main functions in these modules are as follows:
Image Management
vx.Vx |
class for managing both image data and image metadata.
It may be initialized by an image file, vx structure, and np-array or an explicit specification
|
---|---|
vx.vxsh
|
Execute a command in the operating system. Makes possible operations on images within python
and/or external image files.
|
vx.vaparse |
For standalone python programs vaparse performs command line argument parsing
and includes the v4 scheme for documenting command line argument definitions.
It conforms to the v4 argument parsing conventions.
It is much simpler than the python
argparse function.
|
vx.vxstats vx.vxinfo
|
Simple image review functions that return basic descriptive statistics
and information about an image.
|
vx.vrfile vx.vwfile
|
Basic low-level utilities that will read and write all visionx v4 file formats.
These provide access for program developers to all v4 files,
especially those that do not contain pixel-based images.
|
Image Presentation
vd.dispmvx |
Present an image in a Jupyter Notebook using the maplotlib package.
This provides a highly convenient method of presenting one or more images together.
The size of the image is always scaled to fit the designated space, several
presentation options are available.
|
---|---|
vd.dhist |
Present a histogram plot of the image.
|
vd.dispvx |
(depreciated) Present an image in a Jupyter Notebook using the Display feature.
This provides a quick and precise presentation of the image data.
Images with sizes less than 25 pixels are displayed
magnified with pixel values printed.
|
vd.dispsvx |
(depreciated) Presents small images scaled with pixel values printed on each.
This is implemented with maplotlib similar to dispmvx.
|
V4 file supported pixel formats
All numpy data types may be used in python programs. However, currently, only the following pixel data types are supported by v4 image files.
Format | Python type | VisionX Type |
---|---|---|
unsigned byte | uint8 | VX_PBYTE |
signed byte | int8 | VX_PCHAR |
16-bit signed integer | int16 | VX_PSHORT |
32-bit signed integer | int32 | VX_PINT |
32-bit float | float32 | VX_PFLOAT |
64-bit double | float64 | VX_PDOUBLE |
color-map image* | uint8 | VX_PIDX |
V4 image file Metadata
V4 files usually contain a history tag (VX_FHIST) that may used to contain any relevant file metadata in text format. For example, this is used for images that are converted from the DICOM medical image format, to contain image resolution and modality information, that is needed by programs that process these images. In python, this metadata is maintained in vx.Vx.h within the image vx.Vx stucture, and is managed as a separate "header" text string for the low-level vx.vfread and vx.vfwrite functions. This capability may be used to store arbitrary additional information about an image in a v4 image file.
Traditional v4 metadata tag usage
By v4 tradition, the history tag contains the sequence of commands
used to generate a file and may also contain some parametric
information. An additional tag (VX_FCMND) is set to the command used
to generate the file.
When reading a v4 file the
existing command tag is added to the end of the history tag;
this behavior may be prevented by specifying cmnd=False as a parameter
when reading a visionx v4 file.
When writing a file a new command tag is automatically generated;
Some (non-python) v4 programs that generate an
image do not create a history tag; thus, it may not exist in some
v4 files.