# Convert-EMD
Convert-EMD exports images and spectrum data from Velox generated EMD files.
This project is based on [RosettaSciIO](https://github.com/hyperspy/rosettasciio) and [emd-converter](https://github.com/matao1984/emd-converter)
## Install
Environment requirements: `Python >= 3.8`
With pip:
```bash
pip install convert-emd
```
## Usage
```bash
cemd [-h] -f FILE [-o TYPE] [-ns] [-sc COLOR] [-s FLOAT FLOAT FLOAT] [-e Str [Str ...]] [-oe ELEMENT [ELEMENT ...]] [-oa ALPHA] [-sa ALPHA] [-c CONTRAST] [-i INT INT]
```
### Basic Usage
```bash
cemd -f INPUT_FILE
```
Run `cemd -h` for more information.
NOTICE: ".emd" extension should not be included into input filename. For example, if you want to convert "EXEAMPLE.emd", the input should be `cemd -f EXAMPLE` rather than `cemd -f EXAMPLE.emd`
### Output Type
The `-o`/`--out` option allows users to choose the output image type (default: png).
```bash
cemd -f INPUT_FILE -o png ## For PNG type
cemd -f INPUT_FILE -o tif ## For TIF type
...
```
### Scale Bar
#### Remove Scale Bar
The `-ns`/`--no_scale` option can be used to remove the scale bar in images.
```bash
cemd -f INPUT_FILE -ns ## No scale bar will be shown
```
#### Color of Scale Bar
The `-sc`/`--scale_color` option can be used to choose the color of the scale bar (default: white).
```bash
cemd -f INPUT_FILE -sc black ## Black scale bar
cemd -f INPUT_FILE -sc "#000000" ## Hex code can also be used
```
#### Position and Width of Scale Bar
The `-s`/`--scale` option can be used to adjust the postion and width of scale bar (default: x: 0.75, y: 0.9167, width-factor: 150)
```bash
cemd -f INPUT_FILE -s X Y WIDTH
```
NOTICE: Three arguments are required to specify the position and width of scale bar.
`X` and `Y` should be in `float` type and between 0 and 1. They decide the position of scale bar at (X, Y).
`WIDTH` should be a number more than 1. The width of scale bar is given by this factor as `h/f` (where `h` is the height of the image, `f` is the given WIDTH factor).
### Elemental Mapping
#### Color of Elements
Default colors of elemental mapppings are corresponding to the following list in sequnce (*Matplotlib* default colors):
<font color=#1f77b4>1f77b4</font>, <font color=#ff7f0e>ff7f0e</font>, <font color=#2ca02c>2ca02c</font>, <font color=#d62728>d62728</font>, <font color=#9467bd>9467bd</font>, <font color=#8c564b>8c564b</font>, <font color=#e377c2>e377c2</font>, <font color=7f7f7f>7f7f7f</font>, <font color=#bcbd22>bcbd22</font>, <font color=#17becf>17becf</font>
Convert-EMD provides `-e`/`--eds` option for users to customize the color of elemental mappings.
```bash
cemd -f INPUT_FILE -e ELEMENT_1 COLOR_1 ELEMENT_2 COLOR_2 ELEMENT_3 COLOR_3 ...
```
NOTICE: You don't need to specify all elemental colors, those undefined ones will be set according to the default color list.
#### Overlayed Mapping
The `-oe`/`--overlay` option decides which elements are overlyed (default: all).
```bash
cemd -f INPUT_FILE -oe ELEMENT_1 ElEMENT_2 ...
```
Moreover, `-oa`/`--overlay_alpha` and `-sa`/`--substrate_alpha` options are provided to adjust the transparency of elemental layers (default: 1.0) and the HAADF layer (default: 0.5) respectively. The argument should be a float number between 0 and 1, 0 means totally transparent.
### Contrast (Histogram Equalization)
To improve the contrast (especially for HR-TEM), the `-c`/`--contrast` option is provided to introduce the *scikit-image* [histogram equalization](https://scikit-image.org/docs/stable/auto_examples/color_exposure/plot_equalize.html) method with *contrast stretching*.
With this method, the image is rescaled to include all intensities that fall within the given percentiles (default: min = 1, max = 99).
```bash
cemd -f INPUT_FILE -c MIN MAX
```
Raw data
{
"_id": null,
"home_page": null,
"name": "convert-emd",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "electron microscopy, python, eds, emd, img",
"author": null,
"author_email": "Bing-Liang Leng <leng.bl@sjtu.edu.cn>",
"download_url": "https://files.pythonhosted.org/packages/f8/8a/33af9f8a9db9acd7b94116baf4429bbfc8cc25fdf5e56e2214b176b28c3a/convert_emd-0.3.1.tar.gz",
"platform": null,
"description": "# Convert-EMD\n\nConvert-EMD exports images and spectrum data from Velox generated EMD files.\n\nThis project is based on [RosettaSciIO](https://github.com/hyperspy/rosettasciio) and [emd-converter](https://github.com/matao1984/emd-converter)\n\n## Install\n\nEnvironment requirements: `Python >= 3.8`\n\nWith pip:\n\n```bash\npip install convert-emd\n```\n\n## Usage\n\n```bash\ncemd [-h] -f FILE [-o TYPE] [-ns] [-sc COLOR] [-s FLOAT FLOAT FLOAT] [-e Str [Str ...]] [-oe ELEMENT [ELEMENT ...]] [-oa ALPHA] [-sa ALPHA] [-c CONTRAST] [-i INT INT]\n```\n\n### Basic Usage\n\n```bash\ncemd -f INPUT_FILE\n```\n\nRun `cemd -h` for more information.\n\nNOTICE: \".emd\" extension should not be included into input filename. For example, if you want to convert \"EXEAMPLE.emd\", the input should be `cemd -f EXAMPLE` rather than `cemd -f EXAMPLE.emd`\n\n### Output Type\n\nThe `-o`/`--out` option allows users to choose the output image type (default: png).\n\n```bash\ncemd -f INPUT_FILE -o png ## For PNG type\ncemd -f INPUT_FILE -o tif ## For TIF type\n...\n```\n\n### Scale Bar\n\n#### Remove Scale Bar\n\nThe `-ns`/`--no_scale` option can be used to remove the scale bar in images.\n\n```bash\ncemd -f INPUT_FILE -ns ## No scale bar will be shown\n```\n\n#### Color of Scale Bar\n\nThe `-sc`/`--scale_color` option can be used to choose the color of the scale bar (default: white).\n\n```bash\ncemd -f INPUT_FILE -sc black ## Black scale bar\ncemd -f INPUT_FILE -sc \"#000000\" ## Hex code can also be used\n```\n\n#### Position and Width of Scale Bar\n\nThe `-s`/`--scale` option can be used to adjust the postion and width of scale bar (default: x: 0.75, y: 0.9167, width-factor: 150)\n\n```bash\ncemd -f INPUT_FILE -s X Y WIDTH\n```\n\nNOTICE: Three arguments are required to specify the position and width of scale bar.\n\n`X` and `Y` should be in `float` type and between 0 and 1. They decide the position of scale bar at (X, Y).\n\n`WIDTH` should be a number more than 1. The width of scale bar is given by this factor as `h/f` (where `h` is the height of the image, `f` is the given WIDTH factor).\n\n### Elemental Mapping\n\n#### Color of Elements\n\nDefault colors of elemental mapppings are corresponding to the following list in sequnce (*Matplotlib* default colors):\n\n<font color=#1f77b4>1f77b4</font>, <font color=#ff7f0e>ff7f0e</font>, <font color=#2ca02c>2ca02c</font>, <font color=#d62728>d62728</font>, <font color=#9467bd>9467bd</font>, <font color=#8c564b>8c564b</font>, <font color=#e377c2>e377c2</font>, <font color=7f7f7f>7f7f7f</font>, <font color=#bcbd22>bcbd22</font>, <font color=#17becf>17becf</font>\n\nConvert-EMD provides `-e`/`--eds` option for users to customize the color of elemental mappings.\n\n```bash\ncemd -f INPUT_FILE -e ELEMENT_1 COLOR_1 ELEMENT_2 COLOR_2 ELEMENT_3 COLOR_3 ...\n```\n\nNOTICE: You don't need to specify all elemental colors, those undefined ones will be set according to the default color list.\n\n#### Overlayed Mapping\n\nThe `-oe`/`--overlay` option decides which elements are overlyed (default: all).\n\n```bash\ncemd -f INPUT_FILE -oe ELEMENT_1 ElEMENT_2 ...\n```\n\nMoreover, `-oa`/`--overlay_alpha` and `-sa`/`--substrate_alpha` options are provided to adjust the transparency of elemental layers (default: 1.0) and the HAADF layer (default: 0.5) respectively. The argument should be a float number between 0 and 1, 0 means totally transparent.\n\n### Contrast (Histogram Equalization)\n\nTo improve the contrast (especially for HR-TEM), the `-c`/`--contrast` option is provided to introduce the *scikit-image* [histogram equalization](https://scikit-image.org/docs/stable/auto_examples/color_exposure/plot_equalize.html) method with *contrast stretching*.\n\nWith this method, the image is rescaled to include all intensities that fall within the given percentiles (default: min = 1, max = 99).\n\n```bash\ncemd -f INPUT_FILE -c MIN MAX\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Convert Velox generated EMD data into images.",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/blleng/convert-emd",
"Issues": "https://github.com/blleng/convert-emd/issues"
},
"split_keywords": [
"electron microscopy",
" python",
" eds",
" emd",
" img"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a7c1c8c46cc4e82c06963a08307017b04247724326ce068c0f17a9aefe55c153",
"md5": "d15baeceebe77804aadc2fffbe2ad998",
"sha256": "c6f9bc892ea279e4f41b2131d96caeb0534444b704a9e2849917245c3aa22af4"
},
"downloads": -1,
"filename": "convert_emd-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d15baeceebe77804aadc2fffbe2ad998",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 8590,
"upload_time": "2024-09-11T09:27:56",
"upload_time_iso_8601": "2024-09-11T09:27:56.771964Z",
"url": "https://files.pythonhosted.org/packages/a7/c1/c8c46cc4e82c06963a08307017b04247724326ce068c0f17a9aefe55c153/convert_emd-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f88a33af9f8a9db9acd7b94116baf4429bbfc8cc25fdf5e56e2214b176b28c3a",
"md5": "167b77d927289a9422b6362e1fb1770d",
"sha256": "a61ad57cfe5502e122e0620947b9a654bbabbfd929d173ec39bfa03cf40084da"
},
"downloads": -1,
"filename": "convert_emd-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "167b77d927289a9422b6362e1fb1770d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9068,
"upload_time": "2024-09-11T09:27:58",
"upload_time_iso_8601": "2024-09-11T09:27:58.186444Z",
"url": "https://files.pythonhosted.org/packages/f8/8a/33af9f8a9db9acd7b94116baf4429bbfc8cc25fdf5e56e2214b176b28c3a/convert_emd-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-11 09:27:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "blleng",
"github_project": "convert-emd",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "convert-emd"
}