inout¶
-
pysmFISH.stitching_package.inout.
display_tiles
(tiles, tile_set, fig_nr=1, block=True, maximize=False, main_title=None, rgb=False)[source]¶ Plot tiles in subplots
- tiles: list
- List of tiles
- tile_set: np.array
- Tiles organization
- fig_nr: int
- number of the figure window.
- block: bool
- Block causes the program to stop running after plotting the figure, until the figure window is closed.
- maximize: bool
- Maximize plots the figure full screen.
- main_title: str
- Main title adds a title text in the figure.
- rgb: bool
- define the color standard used
-
pysmFISH.stitching_package.inout.
extract_hdf5_refs
(hdf5_group, image_inds)[source]¶ Make a list of the dataset is hdf5_group.
When image_inds is not empty this function returns only the data sets corresponding to the numbers in image_inds.
- hdf5_group: pointer
- HDF5 group reference. Reference to the group from which we should extract the dataset names. The data sets are expected to be numbered.
- image_inds: iterable
- Iterable containing ints. Should contain the names of the datasets that will be selected. This list could also contain strings, as long as it’s contents reflect a subset of dataset names.
- tile_refs: list
- List of strings. The references to the data sets.
-
pysmFISH.stitching_package.inout.
free_hdf5_space
(f)[source]¶ Clean up the hdf5 file after deleting a dataset
After deleting a data set from an hdf5-file, the disk space taken up by that data is not freed. Flushing the hfd5-file may help to keep the file smaller after deleting several data sets.
- f: pointer
- HDF5 file handle. The opened file that needs flushing.
-
pysmFISH.stitching_package.inout.
get_image_names
(hdf5_file, image_list=array([], dtype=float64), hyb_nr=1, gene='Nuclei', pre_proc_level='FilteredData')[source]¶ Get the references to the tiles from the hdf5 file.
If no matching data set was found, None will be used instead of a string reference.
- hdf5_file: pointer
- HDF5 file handle. The file containing the tiles.
- image_list: iterable
- Iterable containing ints. Should contain the names of the data sets that will be selected. This list could also contain strings, as long as it’s contents reflect a subset of dataset names.
- hyb_nr: int
- The number of the hybridization where the data sets can be found. This will be used to navigate tile_file and find the correct tiles. (Default: 1)
- gene: str
- The name of the gene where the data sets can be found. This will be used to navigate tile_file and find the correct tiles. (Default: ‘Nuclei’)
- pre_proc_level: str
- The name of the pre processing group where the data sets can be found. This will be used to navigate tile_file and find the correct tiles. (Default: ‘Filtered’)
-
pysmFISH.stitching_package.inout.
load_stitching_coord
(file_name)[source]¶ Load pickled variables
- file_name: str
- The name of a pickled data file. Should be given without extension.
- : dict
- Unpickled data found in <file_name>’.pkl’
-
pysmFISH.stitching_package.inout.
load_tile
(file_name, hdf5_file=None)[source]¶ Load a tile into memory as 2D image.
- file_name: str
- Hdf5 reference to tile data set.
- hdf5_file: pointer
- HDF5 file handle. Opened HDF5 file containing the tile.
- : np.array
- The tile as 2D image. Or an empty array when the file_name is None.
-
pysmFISH.stitching_package.inout.
load_tile_3D
(file_name, hdf5_file=None)[source]¶ Load a tile into memory as 3D image.
- file_name: str
- Hdf5 reference to tile data set.
- hdf5_file: pointer
- HDF5 file handle. Opened HDF5 file containing the tile.
- : np.array
- The tile as 3D image. Or an empty array when the file_name is None.
-
pysmFISH.stitching_package.inout.
plot_coordinates
(micData, ind_coord_list=None, block=True, name='coordinates', file_name=None, invert_yaxis=True)[source]¶ Plot top-left coordinates with their tile numbers
Coordinates are assumed to be in pixels.
- micData: object
- MicroscopeData object. Containing the coordinates to be plotted.
- block: bool
- Plot blocks the running program untill the plotting window is closed if true (default: True)
- name: str
- Name of the plotting window (default: “coordinates”)
- file_name: str
- Name of the file the image should be saved to. The name should list the complete absolute map. Default/None causes the image to not be saved. (Default: None)
- invert_yaxis: bool
- Invert the y-axis when plotting. (default: True)
-
pysmFISH.stitching_package.inout.
plot_stitched_coordinates
(corner_list, image_list, block=True, name='stitched_coordinates', file_name=None, invert_yaxis=True)[source]¶ Plot top-left coordinates with their tile numbers
Coordinates are assumed to be in pixels.
- corner_list : list
- List with as many elements as there are tiles. Each element contains the tile index (as int) and y and x coordinate of the top left corner (as a numpy array)
- image_list: list
- The list of the numbers of the tiles as they are found in the file names, but reordered to match the order of corner_list.
- block: bool
- Plot blocks the running program untill the plotting window is closed if true (default: True)
- name: str
- Name of the plotting window (default: “coordinates”)
- file_name: str
- Name of the file the image should be saved to. The name should list the complete absolute map. Default/None causes the image to not be saved. (Default: None)
- invert_yaxis: bool
- Invert the y-axis when plotting. (default: True)
-
pysmFISH.stitching_package.inout.
read_IJ_corners
(folder)[source]¶ Read Preibisch corners
Read previously determined global corners from the Preibisch imageJ plugin data. This code starts reading below the line: ‘# Define the image coordinates’ and the file should not contain empty lines after this line.
folder: str Exact path to the folder, including trailing “/”
- compare_corners: list
- List, each element is a list containing the tile_ind and a numpy arrray with the corresponding corner’s y and x coordinates.
-
pysmFISH.stitching_package.inout.
save_image
(im_file, hyb_nr, gene, pre_proc_level, image_name, save_file_name)[source]¶ Save hdf5 file as a tiff image
Save the data found in im_file_name[hyb_nr][gene][pre_proc_level][ image_name] as an image in a tiff-file called save_file_name. im_file should be an hdf5-file and image_name should be a variable in that file.
- im_file: pointer
- HDF5 file handle. Opened HDF5 file containing the image to be saved.
- hyb_nr: int
- Number of the current hybridization.
- gene: str
- The name of the gene where the image to be saved can be found. This will be used to navigate im_file and find the correct image.
- pre_proc_level: str
- The name of the pre processing group where the image to be saved can be found. This will be used to navigate im_file and find the correct image.
- image_name: str
- The name of the dataset containing the image to be saved.
- save_file_name: str
- The name of the image file that is going to be generated, should be given without extension.
-
pysmFISH.stitching_package.inout.
save_to_file
(file_name, **kwargs)[source]¶ Save pickled stitching info to file_name
- file_name: str
- The name of the file where the data will be saved. Should be given without extension.
- **kwarg
- All keyword argument values will be gathered in a dictionary, with the variable name as their key in the dictionary. This dictionary will then be saved in the pickled file.