Powered by OpenAIRE graph
Found an issue? Give us feedback
addClaim

This Research product is the result of merged Research products in OpenAIRE.

You have already added 0 works in your ORCID record related to the merged Research product.

sem_io

Authors: Woodcock, Thomas George;
Abstract

sem_io Helper functions to extract, view and store metadata from the header of SEM images (.tif) recorded using either Zeiss SmartSEM or Thermo Fisher Scientific xT software. Installation Please clone/download the repository and install with pip cd sem_iopip install . Usage Command line To print an overview of parameters from the image header in the console, at the command line: sem_io path/to/my/image.tif To print an overview from several images one after the other, you can use: sem_io path/to/my/image.tif path/to/my/image2.tif path/to/my/image3.tif To print an overview from all images in a folder, you can use: sem_io path/to/my/folder_of_tif_images You can process any number of individual images and folders at the same time: sem_io path/to/my/image.tif path/to/my/folder_of_tif_images path/to/my/image2.tif The flag -d can be used to additionally dump selected metadata to json: sem_io path/to/my/image.tif -d The json file will be located in the same folder as the image and will have the name my_image_metadata.json.As before, you can process any number of images and/or folders of images with the flag -d. To dump metadata from a folder containing many images, without printing the output to the screen,you can additionally use the flag -s: sem_io path/to/my/folder_of_tif_images -d -s or, more simply: sem_io path/to/my/folder_of_tif_images -ds Either of the above two commands will save a json file for each .tif image in the specified folder. If you prefer a simple text file instead of a json, you can pipe the output of sem_io to file like this: sem_io path/to/my/folder_of_tif_images > other/path/my_text_output.txt The above command will put the output of sem_io for all the .tif images in the folder given into a single text file. You can equally do this for a single .tif image by specifying the path to an image instead of to a folder. Python You can also import the module and use the functions directly in Python. >>> import sem_io To print an overview of parameters from the image header in the console: >>> my_params = sem_io.SEMparams(r"path/to/my/image.tif") If you just want to collect and store the parameters and not print them, you can do: >>> my_params = sem_io.SEMparams(r"path/to/my/image.tif", verbose=False) You can print ALL the header parameters to the console like this: >>> my_params.print_param_dict(my_params.params) You can print A SELECTION OF the header parameters (given in the class definition) to the console like this: >>> my_params.print_param_dict(my_params.params_grouped) Both my_params.params and my_params.params_groups are dictionaries and any parameter can be accessed, e.g. >>> date = my_params.params_grouped["General"]["Date"] Alternatively you can dump all the header parameters to a json file (optionally including a key giving the original image path) like this: >>> my_params.dump_params_to_json(my_params.params, "my_json_path.json", image_path=my_params.img_path) Calling the command line interface from Python You can call the functions from the command line within Python using the subprocess module. For example, to dump metadata from a directory of images to json and print the output to the Python terminal: >>> import subprocess>>> subprocess.run(["sem_io", "path/to/my/folder_of_tif_images", "-d"]) To pipe the output of sem_io to a text file instead: >>> with open("my/output/path/myfile.txt", "w") as output_file:... process = subprocess.Popen(["sem_io", r"path/to/my/image.tif"], stdout=output_file)... process.communicate()... Getting the Image Pixel Size and Adding a Scalebar All the functions are staticmethods, so you don't need to instantiate the SEMparams class at all. For example, there is a bespoke function for getting the image pixel size and its unit in one line of code: >>> pixel_size, unit = sem_io.SEMparams.get_image_pixel_size(r"path/to/my/image.tif") This is useful if you want to plot the SEM image using matplotlib and add a scalebar with the correct dimensions using matplotlib-scalebar. Here's the whole process as an example: >>> import matplotlib.pyplot as plt>>> from matplotlib_scalebar.scalebar import ScaleBar>>> import sem_io>>> my_image = plt.imread("path_to_my_image.tif")>>> fig, ax = plt.subplots()>>> ax.imshow(my_image, cmap='gray')>>> pixel_size, unit = sem_io.SEMparams.get_image_pixel_size("path_to_my_image.tif")>>> my_scalebar = ScaleBar(pixel_size, units=unit, location='lower right', scale_loc='top')>>> ax.add_artist(my_scalebar) Even Electron Channeling Patterns acquired in rocking beam mode are correctly handled by sem_io.SEMparams.get_image_pixel_size() Dependencies Pillow General The selected parameters defined in the class definition of SEMparams form a subset of those available in the header of the .tif image. If you are interested in other parameters, the program can be easily customised - all the header parameters are extracted and are available as the "params" instance attribute.

Keywords

Metadata, Electron microscopy, Microscopy, Electron, Scanning, research data management, scanning electron microscopy

  • BIP!
    Impact byBIP!
    citations
    This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
    0
    popularity
    This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network.
    Average
    influence
    This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
    Average
    impulse
    This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.
    Average
Powered by OpenAIRE graph
Found an issue? Give us feedback
citations
This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
BIP!Citations provided by BIP!
popularity
This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network.
BIP!Popularity provided by BIP!
influence
This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically).
BIP!Influence provided by BIP!
impulse
This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network.
BIP!Impulse provided by BIP!
0
Average
Average
Average