axoden.volume_projections¶
Usually, it is enough to just import the functions from axoden directly. axoden.volume_projections contains the full functionality used for axoden.
- axoden.volume_projections.binarize_image(image, threshold)¶
Binarize the image using the threshold provided.
- axoden.volume_projections.collect_image_mask(img_path: any, is_masked: bool) Tuple[ndarray, ndarray] ¶
Open the image and cut it to the area that contains tissue.
- Parameters:
img_path – A filename (string), os.PathLike object or a file object.
is_masked – True if the image was masked and contains regions that are set to a value of 0.
- Returns:
A tuple containing the cut image and the mask.
- Return type:
Tuple[np.ndarray, np.ndarray]
- axoden.volume_projections.collect_info_from_filename(filename: str) Tuple[str, str, str] ¶
Collect the animal, brain area and group from the filename.
- Parameters:
filename (str) – Name of the file.
- Returns:
A tuple containing the animal, brain area and group.
- Return type:
Tuple[str, str, str]
- axoden.volume_projections.compute_area(img, pixel_size)¶
Compute the area of the image and the area of the white and black pixels.
- axoden.volume_projections.control_plot_steps(ax, img, title, axs_info)¶
Create the subplots of the control plots for each input image.
- Parameters:
ax (list of matplotlib Axes) – List of Axes objects to plot the images.
img (numpy array) – Input image data.
title (str) – Title for the plot.
axs_info (dict or list) – Information about the axes.
- Returns:
List of Axes objects with the plotted images.
- Return type:
ax (list of matplotlib Axes)
- axoden.volume_projections.count_pixels(img)¶
Count the number of white and black pixels in the image.
- axoden.volume_projections.generate_background_mask(img, is_masked)¶
Generate a background mask for the image provided.
- axoden.volume_projections.get_tif_files(folder_path)¶
Get all the tif files in the folder provided.
- axoden.volume_projections.intensity_along_axis(img, ax=None)¶
Compute the intensity along the x or y axis of the image.
- axoden.volume_projections.load_table(file_path: str)¶
Load a table from a csv file.
- Parameters:
file_path (str) – Path to the csv file.
- Returns:
A DataFrame with the data from the csv file.
- Return type:
pd.DataFrame
- axoden.volume_projections.make_figures_pdf_editable()¶
Make the figures editable in Adobe Illustrator.
- axoden.volume_projections.open_tif_image(img_path)¶
Open a tif image.
- Parameters:
img_path – A filename (string), os.PathLike object or a file object.
- Returns:
A PIL Image object.
- Return type:
Image
- axoden.volume_projections.plot_signal_intensity_along_axis(project_name: str, df: DataFrame, pixel_size: float)¶
Plot the signal intensity along the x and y axis of the DataFrame.
- Parameters:
project_name (str) – Name of the project.
df (pd.DataFrame) – DataFrame with the data to plot.
pixel_size (float) – Pixel size in micrometers.
- Returns:
A figure with the signal intensity along the x and y axis.
- Return type:
plt.Figure
- axoden.volume_projections.process_folder(folder_path: str, pixel_size: float, is_masked: bool, output_folder: str = None, save: bool = True) Tuple[DataFrame, DataFrame] ¶
Process all images in a folder.
Optionally save the data to csv files and the control plots to pdf files.
- Parameters:
folder_path (str) – Path to the folder containing the images.
pixel_size (float) – Pixel size in micrometers.
is_masked (bool) – True if the image was masked and contains regions that are set to a value of 0.
output_folder (str) – Path to the folder where the data will be saved. If not set, the input folder will be used.
save (bool) – True if the control plots should be saved. Default is True.
- Returns:
A tuple containing the data for the images and the data for the axis.
- Return type:
Tuple[pd.DataFrame, pd.DataFrame]
- axoden.volume_projections.process_image(file_name: any, is_masked: bool, pixel_size: float, animal: str = 'animal1', brain_area: str = 'brain_area1', group: str = 'group1') Tuple[Figure, dict, dict] ¶
Process a single image and generate a control plot.
- Parameters:
file_name (any) – A filename (string), os.PathLike object or a file object.
is_masked (bool) – True if the image was masked and contains regions that are set to a value of 0.
pixel_size (float) – Pixel size in micrometers.
animal (str) – Name of the animal. Default is “animal1”.
brain_area (str) – Name of the brain area. Default is “brain_area1”.
group (str) – Name of the group. Default is “group1”.
- Returns:
A tuple containing the figure, the data for the image and the data with the axis projections.
- Return type:
Tuple[plt.Figure, dict, dict]
- axoden.volume_projections.remove_spines_plot(ax, loc=['all'])¶
Remove the spines of the plot.
- axoden.volume_projections.remove_ticks_plot(ax, loc='all')¶
Remove the ticks of the plot.
- axoden.volume_projections.save_table(df: DataFrame, folderpath: str, filename: str)¶
Save a table to a csv file.
- Parameters:
df (pd.DataFrame) – DataFrame to save.
folderpath (str) – Path to the folder where the file will be saved.
filename (str) – Name of the file.
- axoden.volume_projections.write_signal_intensity_along_axis_plot(output_folder: str, df: DataFrame, pixel_size: float, project_name: str = None)¶
Write the signal intensity along the axis to a pdf file in the folder provided.
- Parameters:
folderpath (str) – Path to the folder where the data will be saved.
df (pd.DataFrame) – Dataframe with the axis data to plot.
pixel_size (float) – Pixel size in micrometers.
project_name (str) – Name of the project. If not set, it will be the name of the output folder.
- axoden.volume_projections.write_summary_data_plot(folder_path: str, df_input: DataFrame, project_name: str = None)¶
Write the summary data plot to a pdf file in the folder provided.
- Parameters:
folder_path (str) – Path to the folder where the data will be saved.
df_input (pd.DataFrame) – Dataframe with the data to plot.
project_name (str) – Name of the project. If not set, default to the folder name.