Write Chimera Map (CMAP) files
==============================
Cmapfile is a Python library and console script to write Chimera Map (CMAP)
files, HDF5 files containing series of 3D XYZ datasets.
CMAP files can be created from numpy arrays and various file formats
containing volume data, for example, BIN, TIFF, LSM, OIF, and OIB.
CMAP files can be visualized using UCSF Chimera [2], a program for interactive
visualization and analysis of molecular structures and related data.
:Author: `Christoph Gohlke <https://www.cgohlke.com>`_
:License: BSD 3-Clause
:Version: 2024.8.28
Quickstart
----------
Install the cmapfile package and all dependencies from the
`Python Package Index <https://pypi.org/project/cmapfile/>`_::
python -m pip install -U cmapfile[all]
Print the command line usage::
python -m cmapfile --help
See `Examples`_ for usage cases.
Source code and support are available on
`GitHub <https://github.com/cgohlke/cmapfile>`_.
Requirements
------------
This revision was tested with the following requirements and dependencies
(other versions may work):
- `CPython <https://www.python.org>`_ 3.10.11, 3.11.9, 3.12.5, 3.13.0rc1 64-bit
- `NumPy <https://pypi.org/project/numpy/>`_ 2.1.0
- `Scipy <https://pypi.org/project/scipy/>`_ 1.14.1
- `H5py <https://pypi.org/project/h5py/>`_ 3.11.0
- `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.8.24
- `Oiffile <https://pypi.org/project/oiffile/>`_ 2024.5.24
Revisions
---------
2024.8.28
- Fix lsm2cmap with tifffile > 2024.8.24.
- Drop support for Python 3.9 and numpy < 1.24 (NEP29).
2023.8.30
- Drop support for Python 3.8 and numpy < 1.22 (NEP29).
2022.9.29
- Make subsampling compatible with ChimeraX (breaking).
- Fix deprecated import of scipy.ndimage.interpolation.zoom.
- Switch to Google style docstrings.
2022.2.2
- Add type hints.
- Drop support for Python 3.7 and numpy < 1.19 (NEP29).
2021.2.26
- Fix LSM conversion with tifffile >= 2021.2.26.
- Remove support for Python 3.6 (NEP 29).
2020.1.1
- Do not write name attribute.
- Remove support for Python 2.7 and 3.5.
- Update copyright.
2018.8.30
- Move cmapfile.py into cmapfile package.
2014.10.10
- Initial release.
Notes
-----
The CMAP file format according to [1]::
Example of HDF format written by Chimera (Chimera map format) follows.
The Chimera map file reader will allow all fields to be missing (except
the 3D data).
/image (group, any name allowed)
name "centriole" (attribute)
step (1.2, 1.2, 1.2) (attribute)
origin (-123.4, -522, 34.5) (attribute)
cell_angles (90.0, 90.0, 90.0) (attribute)
rotation_axis (0.0, 0.0, 1.0) (attribute)
rotation_angle 45.0 (attribute, degrees)
color (1.0, 1.0, 0, 1.0) (attribute, rgba 0-1 float)
time 5 (attribute, time series frame number)
channel 0 (attribute, integer for multichannel data)
/data (3d array of uint8 (123,542,82)) (dataset, any name allowed)
/data_x (3d array of uint8 (123,542,82), alternate chunk shape) (dataset)
/data_2 (3d array of uint8 (61,271,41)) (dataset, any name allowed)
subsample_spacing (2, 2, 2) (attribute)
(more subsampled or alternate chunkshape versions of same data)
References
----------
1. Thomas Goddard. [Chimera-users] reading in hdf5 files in chimera.
https://www.cgl.ucsf.edu/pipermail/chimera-users/2008-September/003052.html
2. UCSF Chimera, an extensible molecular modeling system.
https://www.cgl.ucsf.edu/chimera/
3. Globals for Images - SimFCS. https://www.lfd.uci.edu/globals/
Examples
--------
Convert a 5D LSM file to CMAP file::
$ python -m cmapfile "/my data directory/large.lsm"
Convert all BIN files in the current directory to test.cmap. The BIN files
are known to contain 128x128x64 samples of 16-bit integers. The CMAP file
will store float32 maps using subsampling up to 16::
$ python -m cmapfile --shape 128,128,64 --step 1,1,2 --dtype i2 \
--cmap test.cmap --subsample 16 --astype float32 *.bin
Change the step size in the CMAP file::
$ python -m cmapfile --step 1,1,1.5 test.cmap
Print the cmapfile script usage::
$ python -m cmapfile --help
Usage: cmapfile [options] files
Convert volume data files to Chimera MAP files.
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-q, --quiet
--filetype=FILETYPE type of input file(s).
For example, BIN, LSM, OIF, TIF
--dtype=DTYPE type of data in BIN files. For example, uint16
--shape=SHAPE shape of data in BIN files in F order.
For example, 256,256,32
--offset=OFFSET number of bytes to skip at beginning of BIN files
--step=STEP stepsize of data in files in F order.
For example, 1.0,1.0,8.0
--cmap=CMAP name of output CMAP file
--astype=ASTYPE type of data in CMAP file. For example, float32
--subsample=SUBSAMPLE
write subsampled datasets to CMAP file
Raw data
{
"_id": null,
"home_page": "https://www.cgohlke.com",
"name": "cmapfile",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Christoph Gohlke",
"author_email": "cgohlke@cgohlke.com",
"download_url": "https://files.pythonhosted.org/packages/ff/21/4a08087aa54cbaca81ec338b505bef060c5fc375f7256bfb7c1029c9d40e/cmapfile-2024.8.28.tar.gz",
"platform": "any",
"description": "Write Chimera Map (CMAP) files\r\n==============================\r\n\r\nCmapfile is a Python library and console script to write Chimera Map (CMAP)\r\nfiles, HDF5 files containing series of 3D XYZ datasets.\r\n\r\nCMAP files can be created from numpy arrays and various file formats\r\ncontaining volume data, for example, BIN, TIFF, LSM, OIF, and OIB.\r\n\r\nCMAP files can be visualized using UCSF Chimera [2], a program for interactive\r\nvisualization and analysis of molecular structures and related data.\r\n\r\n:Author: `Christoph Gohlke <https://www.cgohlke.com>`_\r\n:License: BSD 3-Clause\r\n:Version: 2024.8.28\r\n\r\nQuickstart\r\n----------\r\n\r\nInstall the cmapfile package and all dependencies from the\r\n`Python Package Index <https://pypi.org/project/cmapfile/>`_::\r\n\r\n python -m pip install -U cmapfile[all]\r\n\r\nPrint the command line usage::\r\n\r\n python -m cmapfile --help\r\n\r\nSee `Examples`_ for usage cases.\r\n\r\nSource code and support are available on\r\n`GitHub <https://github.com/cgohlke/cmapfile>`_.\r\n\r\nRequirements\r\n------------\r\n\r\nThis revision was tested with the following requirements and dependencies\r\n(other versions may work):\r\n\r\n- `CPython <https://www.python.org>`_ 3.10.11, 3.11.9, 3.12.5, 3.13.0rc1 64-bit\r\n- `NumPy <https://pypi.org/project/numpy/>`_ 2.1.0\r\n- `Scipy <https://pypi.org/project/scipy/>`_ 1.14.1\r\n- `H5py <https://pypi.org/project/h5py/>`_ 3.11.0\r\n- `Tifffile <https://pypi.org/project/tifffile/>`_ 2024.8.24\r\n- `Oiffile <https://pypi.org/project/oiffile/>`_ 2024.5.24\r\n\r\nRevisions\r\n---------\r\n\r\n2024.8.28\r\n\r\n- Fix lsm2cmap with tifffile > 2024.8.24.\r\n- Drop support for Python 3.9 and numpy < 1.24 (NEP29).\r\n\r\n2023.8.30\r\n\r\n- Drop support for Python 3.8 and numpy < 1.22 (NEP29).\r\n\r\n2022.9.29\r\n\r\n- Make subsampling compatible with ChimeraX (breaking).\r\n- Fix deprecated import of scipy.ndimage.interpolation.zoom.\r\n- Switch to Google style docstrings.\r\n\r\n2022.2.2\r\n\r\n- Add type hints.\r\n- Drop support for Python 3.7 and numpy < 1.19 (NEP29).\r\n\r\n2021.2.26\r\n\r\n- Fix LSM conversion with tifffile >= 2021.2.26.\r\n- Remove support for Python 3.6 (NEP 29).\r\n\r\n2020.1.1\r\n\r\n- Do not write name attribute.\r\n- Remove support for Python 2.7 and 3.5.\r\n- Update copyright.\r\n\r\n2018.8.30\r\n\r\n- Move cmapfile.py into cmapfile package.\r\n\r\n2014.10.10\r\n\r\n- Initial release.\r\n\r\nNotes\r\n-----\r\n\r\nThe CMAP file format according to [1]::\r\n\r\n Example of HDF format written by Chimera (Chimera map format) follows.\r\n The Chimera map file reader will allow all fields to be missing (except\r\n the 3D data).\r\n\r\n /image (group, any name allowed)\r\n name \"centriole\" (attribute)\r\n step (1.2, 1.2, 1.2) (attribute)\r\n origin (-123.4, -522, 34.5) (attribute)\r\n cell_angles (90.0, 90.0, 90.0) (attribute)\r\n rotation_axis (0.0, 0.0, 1.0) (attribute)\r\n rotation_angle 45.0 (attribute, degrees)\r\n color (1.0, 1.0, 0, 1.0) (attribute, rgba 0-1 float)\r\n time 5 (attribute, time series frame number)\r\n channel 0 (attribute, integer for multichannel data)\r\n /data (3d array of uint8 (123,542,82)) (dataset, any name allowed)\r\n /data_x (3d array of uint8 (123,542,82), alternate chunk shape) (dataset)\r\n /data_2 (3d array of uint8 (61,271,41)) (dataset, any name allowed)\r\n subsample_spacing (2, 2, 2) (attribute)\r\n (more subsampled or alternate chunkshape versions of same data)\r\n\r\nReferences\r\n----------\r\n\r\n1. Thomas Goddard. [Chimera-users] reading in hdf5 files in chimera.\r\n https://www.cgl.ucsf.edu/pipermail/chimera-users/2008-September/003052.html\r\n2. UCSF Chimera, an extensible molecular modeling system.\r\n https://www.cgl.ucsf.edu/chimera/\r\n3. Globals for Images - SimFCS. https://www.lfd.uci.edu/globals/\r\n\r\nExamples\r\n--------\r\n\r\nConvert a 5D LSM file to CMAP file::\r\n\r\n $ python -m cmapfile \"/my data directory/large.lsm\"\r\n\r\nConvert all BIN files in the current directory to test.cmap. The BIN files\r\nare known to contain 128x128x64 samples of 16-bit integers. The CMAP file\r\nwill store float32 maps using subsampling up to 16::\r\n\r\n $ python -m cmapfile --shape 128,128,64 --step 1,1,2 --dtype i2 \\\r\n --cmap test.cmap --subsample 16 --astype float32 *.bin\r\n\r\nChange the step size in the CMAP file::\r\n\r\n $ python -m cmapfile --step 1,1,1.5 test.cmap\r\n\r\nPrint the cmapfile script usage::\r\n\r\n $ python -m cmapfile --help\r\n\r\n Usage: cmapfile [options] files\r\n\r\n Convert volume data files to Chimera MAP files.\r\n\r\n Options:\r\n --version show program's version number and exit\r\n -h, --help show this help message and exit\r\n -q, --quiet\r\n --filetype=FILETYPE type of input file(s).\r\n For example, BIN, LSM, OIF, TIF\r\n --dtype=DTYPE type of data in BIN files. For example, uint16\r\n --shape=SHAPE shape of data in BIN files in F order.\r\n For example, 256,256,32\r\n --offset=OFFSET number of bytes to skip at beginning of BIN files\r\n --step=STEP stepsize of data in files in F order.\r\n For example, 1.0,1.0,8.0\r\n --cmap=CMAP name of output CMAP file\r\n --astype=ASTYPE type of data in CMAP file. For example, float32\r\n --subsample=SUBSAMPLE\r\n write subsampled datasets to CMAP file\r\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Write Chimera Map (CMAP) files",
"version": "2024.8.28",
"project_urls": {
"Bug Tracker": "https://github.com/cgohlke/cmapfile/issues",
"Homepage": "https://www.cgohlke.com",
"Source Code": "https://github.com/cgohlke/cmapfile"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "aa88b957083c672754b1ed112d36afdad8fe9eba513f5821957ce41ac7a93f0a",
"md5": "21c84858584ed88069ac78ba8d140bba",
"sha256": "e4761f12dec980c0bc47dab0c7cad30d9a7227b927be849f5b1ed8c0fe47e10a"
},
"downloads": -1,
"filename": "cmapfile-2024.8.28-py3-none-any.whl",
"has_sig": false,
"md5_digest": "21c84858584ed88069ac78ba8d140bba",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 14339,
"upload_time": "2024-08-27T23:22:50",
"upload_time_iso_8601": "2024-08-27T23:22:50.227150Z",
"url": "https://files.pythonhosted.org/packages/aa/88/b957083c672754b1ed112d36afdad8fe9eba513f5821957ce41ac7a93f0a/cmapfile-2024.8.28-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ff214a08087aa54cbaca81ec338b505bef060c5fc375f7256bfb7c1029c9d40e",
"md5": "231b15da321da4afc2646cb40e388f33",
"sha256": "763f9a21bdb4f047aba388ac4171c77a3243632fb38b8689c316a28d9614ed3d"
},
"downloads": -1,
"filename": "cmapfile-2024.8.28.tar.gz",
"has_sig": false,
"md5_digest": "231b15da321da4afc2646cb40e388f33",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 14040,
"upload_time": "2024-08-27T23:22:51",
"upload_time_iso_8601": "2024-08-27T23:22:51.564239Z",
"url": "https://files.pythonhosted.org/packages/ff/21/4a08087aa54cbaca81ec338b505bef060c5fc375f7256bfb7c1029c9d40e/cmapfile-2024.8.28.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-27 23:22:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cgohlke",
"github_project": "cmapfile",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cmapfile"
}