Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 801bc197 authored by NADAL Morgane's avatar NADAL Morgane
Browse files

Changed MIP fct (not using SimpleITK anymore)

parent 856559c7
No related branches found
No related tags found
1 merge request!2Create graphs and change the root search
......@@ -41,18 +41,12 @@ import mpl_toolkits.mplot3d as p3_
import numpy as np_
import skimage.measure as ms_
import SimpleITK as sitk
def MaximumIntensityProjectionZ(img: array_t, cmap: str ='tab20', output_image_file_name: str = None) -> None:
def MaximumIntensityProjectionZ(img: array_t, cmap: str ='tab20', axis: int = 0, output_image_file_name: str = None) -> None:
""" Maximum Image Projection on the Z axis. """
#
image = sitk.GetImageFromArray(img)
# image_size = image.GetSize()
# print('Image Size = ', image_size)
projection = sitk.MaximumProjection(image, 2)
np_img = sitk.GetArrayFromImage(projection)
pl_.imshow(np_img[0, :, :], cmap=cmap)
xy = np_.amax(img, axis=axis)
pl_.imshow(xy, cmap=cmap)
pl_.show(block=True)
if output_image_file_name is not None:
pl_.imsave(output_image_file_name, np_img[0, :, :], cmap=cmap)
......
......@@ -342,7 +342,7 @@ po_.MaximumIntensityProjectionZ(ext_nfo['lmp_ext'])
# Extract the graph of each extension of a soma
print('\n--- Graph extraction\n')
ext_map = skl_map_t.FromShapeMap(ext_nfo['lmp_ext'], store_widths=True, skeletonize=False, do_post_thinning=False)
ext_map = skl_map_t.FromShapeMap(ext_nfo['lmp_ext'], store_widths=True, skeletonize=False) # , do_post_thinning=True
ext_skl_graph = skl_graph_t.FromSkeleton(ext_map)
# --- Some info about the skeleton graphs
......@@ -381,3 +381,23 @@ ext_skl_graph = ge_.FindGraphsRoot(somas, ext_skl_graph)
elapsed_time = tm_.gmtime(tm_.time() - start_time)
print(f"\nElapsed Time={tm_.strftime('%Hh %Mm %Ss', elapsed_time)}")
print(f"DONE: {tm_.strftime('%a, %b %d %Y @ %H:%M:%S')}")
# for node_id,node_id2, edge_nfo in ext_skl_graph.edges.data('as_edge_t'):
# ... if (ext_skl_graph.degree[node_id] == 1) or (ext_skl_graph.degree[node_id2] == 1):
# ... print(edge_nfo.sites)
# # Pour un soma donne
# # primary_extension_sites = tuple(set(zip(*extension.sites) for extension in soma.extensions)
# primary_extension_uids = tuple(extension.uid for extension in soma.extensions)
# for node_id,node_id2, edge_nfo in ext_skl_graph.edges.data('as_edge_t'):
# if (ext_skl_graph.degree[node_id] == 1) or (ext_skl_graph.degree[node_id2] == 1):
# ext_uid = np_.unique(ext_nfo['lmp'][edge_nfo.sites])[1]
# if ext_uid in primary_extension_uids:
# if ext_skl_graph.degree[node_id] == 1:
# root_node = node_id
# else:
# root_node = node_id2
# # print(edge_nfo.sites)
# # edge_sites = set(zip(*edge_nfo.sites))
# # intersections = map(in)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment