{ "info": { "author": "Talley Lambert", "author_email": "talley.lambert@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Visualization" ], "description": "# tifffolder\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nLazily read a subset of data from a folder of images using numpy slicing syntax. Includes simplified but robust file pattern matching syntax and multithreaded file reading. Note: this is not intended to promote a folder of tiffs as a useful way to store lots of information (things like hdf5/n5/klb are preferable). But for data that begins as a folder of tiffs, tifffolder simplifies the process of parsing that folder into data along different axes (and could be used as an intermediate step in the coversion to a better format if desired).\n\n### Install with pip\n\n```bash\n$ pip install tifffolder\n```\n\n### Install with conda\n\n```bash\n$ conda install -c talley tifffolder\n```\n\n### Usage\n\n```python\n>>> from tifffolder import TiffFolder\n>>> tf = TiffFolder('/folder/of/tiffs', patterns={'t': '_stack{d4}', 'c': '_ch{d1}'})\n\n# get dataset shape and order of axes\n>>> tf.shape\n(10, 2, 65, 184, 157) # (nt, nc, nz, ny, nx)\n>>> tf.axes\n'tczyx'\n\n# reorder data (still experimental)\n>>> tf.axes = 'tzcxy'\n>>> tf.shape\n(10, 65, 2, 157, 184)\n\n# data is only read from disk when explicitly indexed\n# get the last 10 Z planes from every other timepoint, \n# in the first channel cropping to the middle half in Y\n>>> data = tf[::2, 0, -10:, tf.shape[-2] * 1 // 4 : tf.shape[-2] * 3 // 4 ]\n>>> data.shape\n(5, 10, 92, 157) # (nt, nz, ny, nx)\n\n\n# Can also be used as an iterator/generator for lazily reading data\n>>> for timepoint in tf:\n>>> do_something(timepoint)\n \n# or just load the whole thing\n>>> alldata = tf.asarray()\n>>> alldata.shape == tf.shape\nTrue\n\n# asarray() also accepts any axis kwargs\n>>> somedata = tf.asarray(t=range(1,10), c=0)\n\n# Or just to select filenames along certain axes:\n>>> tf.select_filenames(t=range(1,10,2), c=0)\n['./test_ch0_stack0001_488nm.tif',\n './test_ch0_stack0003_488nm.tif',\n './test_ch0_stack0005_488nm.tif',\n './test_ch0_stack0007_488nm.tif',\n './test_ch0_stack0009_488nm.tif']\n```\n\n### Specifying filename patterns:\n\ntifffolder converts a simplified regex syntax into relatively robust lookahead regex that will match patterns in any order in the filename or fail elegantly.\n\nThe TiffFolder class accepts a `patterns` parameter (dict or list of two-tuples). For each (key, value) in the `patterns` dict:\n* key = the axis name (e.g. `'x', 'y', 'z', 'c', 't', 's'`)\n* value = the simplified regex where:\n - things in brackets `{}` will be captured\n - things outside of brackest will be required to match, but not captured\n - `{d}` means match any number of digits\n - `{D}` means match any number of NON-digits\n - `{}` means match any alphanumeric character (excluding underscore)\n - `{d2}` means match exactly two digits (for example)\n\n\nFor example:\n\n```python\n>>> patterns = {\n 'rel': '_{d7}msec',\n 'w': '_{d3}nm',\n 't': '_stack{d4}',\n 'c': '_ch{d1}',\n 'cam': 'Cam{D1}'\n}\n>>> tf = TiffFolder('/folder/of/tiffs', patterns)\n>>> tf._parse_filename('cell1_ch0_stack0009_488nm_0034829msec.tif')\n{'rel': 34829, 'w': 488, 't': 9, 'c': 0, 'cam': None}\n\n>>> tf._parse_filename('cell1_CamA_ch2_stack0001_560nm_0034829msec.tif')\n{'rel': 34829, 'w': 560, 't': 1, 'c': 2, 'cam': 'A'}\n\n>>> tifffolder.build_regex('cam', 'Cam{}')\n'(?=.*Cam(?P[a-zA-Z0-9]+))?'\n\n>>> tifffolder.build_regex('c', '_ch{d1}')\n'(?=.*_ch(?P\\\\d{1}))?'\n```\n\n\n##### todo\n* check axis reordering\n* check z planes across files", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tlambert03/tifffolder", "keywords": "image,analysis,tiff", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "tifffolder", "package_url": "https://pypi.org/project/tifffolder/", "platform": "", "project_url": "https://pypi.org/project/tifffolder/", "project_urls": { "Code": "https://github.com/tlambert03/tifffolder", "Homepage": "https://github.com/tlambert03/tifffolder", "Issue tracker": "https://github.com/tlambert03/tifffolder/issues" }, "release_url": "https://pypi.org/project/tifffolder/0.1.7/", "requires_dist": null, "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "summary": "Easily parse/access a subset of data from a <=6D folder of TIFFs", "version": "0.1.7" }, "last_serial": 4312886, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "364c22a2b4e82f0f335d8fce188fb85d", "sha256": "89cbc2379614be97d9ed322b3d70d2855c6eac4fb25dc169035d3f8b693f22e8" }, "downloads": -1, "filename": "tifffolder-0.0.2.tar.gz", "has_sig": false, "md5_digest": "364c22a2b4e82f0f335d8fce188fb85d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "size": 5457, "upload_time": "2018-06-01T14:13:10", "url": "https://files.pythonhosted.org/packages/99/bc/f4db2b1c6f1903c5e8896816c2169cc21bb9358bfe4d88d88cef7f0a46c9/tifffolder-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "7864a2bc574813b942945c5d664deff1", "sha256": "09a7bec71f111a1ccf541c7bf6fc01b21fb397ecb257fbb3b2aad357bbd2d5ca" }, "downloads": -1, "filename": "tifffolder-0.0.3.tar.gz", "has_sig": false, "md5_digest": "7864a2bc574813b942945c5d664deff1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "size": 5499, "upload_time": "2018-06-01T14:31:02", "url": "https://files.pythonhosted.org/packages/89/98/aba026feccf96715ab0f977e445c49946769fd6366e0a4200bd1a27e2ecc/tifffolder-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "85be6564bf3cfce1b791b6bdbcd0f43a", "sha256": "fb2b3ac574fc6c4c56a30e4d32a726221d8614da32878530bc7f48306f82b80d" }, "downloads": -1, "filename": "tifffolder-0.0.4.tar.gz", "has_sig": false, "md5_digest": "85be6564bf3cfce1b791b6bdbcd0f43a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "size": 5497, "upload_time": "2018-06-01T14:51:48", "url": "https://files.pythonhosted.org/packages/06/d1/874ee6f47921a78da120fa393faa6e82b0a561682df53e929b259ec12353/tifffolder-0.0.4.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "a2bc9f3ef3e313d35d82c5593921c03b", "sha256": "43416fb270881f6052f5622d7d089eac585c9679b307cbf763487db5e60a8ea5" }, "downloads": -1, "filename": "tifffolder-0.1.3.tar.gz", "has_sig": false, "md5_digest": "a2bc9f3ef3e313d35d82c5593921c03b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "size": 7043, "upload_time": "2018-06-02T02:06:25", "url": "https://files.pythonhosted.org/packages/7d/52/2505e69637a7211ae96dd625b45b6d669f94291cb002f95ce73e39ac667c/tifffolder-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "101001c02a1ceb18a494b3f029f041fa", "sha256": "ceff31272e25f2b6c4871bda3a20dcc5a13f921363393ddd85227685cc6d6b17" }, "downloads": -1, "filename": "tifffolder-0.1.4.tar.gz", "has_sig": false, "md5_digest": "101001c02a1ceb18a494b3f029f041fa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "size": 7032, "upload_time": "2018-06-02T02:25:59", "url": "https://files.pythonhosted.org/packages/66/37/3ef2b901efb6f53010ba88454a330dbff633a0e1f28ed3915b91f4ba44ec/tifffolder-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "dd17c62a9093e4d90e3a51c59d7d18e3", "sha256": "8c068e6bb3de6df35e1487e3be641bfbb85cd1ae7839aaac82622894b76f1ced" }, "downloads": -1, "filename": "tifffolder-0.1.5.tar.gz", "has_sig": false, "md5_digest": "dd17c62a9093e4d90e3a51c59d7d18e3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "size": 8799, "upload_time": "2018-06-02T18:23:16", "url": "https://files.pythonhosted.org/packages/b6/75/4ac09a3c15acea7ec5c84a1fd8eb0948272dcc73c04f29457779be37ef3c/tifffolder-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "ad23d5951ae6bff533e6c92fd923f65d", "sha256": "52b66ab4e875ccbd73fccc2326550b1ccd07780b6284691fb5597fa4d8d07e87" }, "downloads": -1, "filename": "tifffolder-0.1.6.tar.gz", "has_sig": false, "md5_digest": "ad23d5951ae6bff533e6c92fd923f65d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "size": 9803, "upload_time": "2018-06-04T01:19:31", "url": "https://files.pythonhosted.org/packages/48/84/6fe1a2b594140c5232f539c2062ec98fe6bc19a928eb2dfa82283f0b37b2/tifffolder-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "f3e6e25aead30a384047e5f1d7370f13", "sha256": "b54c9e9c4db4eb49c3aa2768eb8f7add798f3983e29a09717d8a58951f0c4881" }, "downloads": -1, "filename": "tifffolder-0.1.7.tar.gz", "has_sig": false, "md5_digest": "f3e6e25aead30a384047e5f1d7370f13", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "size": 12942, "upload_time": "2018-09-26T14:45:35", "url": "https://files.pythonhosted.org/packages/e0/67/097b5174f2e4c7a9d9f53f52fd76c17dd23c9eea22e4eea5fdf9080604c5/tifffolder-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f3e6e25aead30a384047e5f1d7370f13", "sha256": "b54c9e9c4db4eb49c3aa2768eb8f7add798f3983e29a09717d8a58951f0c4881" }, "downloads": -1, "filename": "tifffolder-0.1.7.tar.gz", "has_sig": false, "md5_digest": "f3e6e25aead30a384047e5f1d7370f13", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*", "size": 12942, "upload_time": "2018-09-26T14:45:35", "url": "https://files.pythonhosted.org/packages/e0/67/097b5174f2e4c7a9d9f53f52fd76c17dd23c9eea22e4eea5fdf9080604c5/tifffolder-0.1.7.tar.gz" } ] }