Commit 68c5cf95 authored by Martinez-Carvajal German's avatar Martinez-Carvajal German
Browse files

same thing, adding rw

parent d9622d9a
......@@ -151,7 +151,7 @@ def SurfaceCouchyCrofton_2(Image, Resolution, p2, Surface_of_p1):
return (Surface, Max, (Family1, Family2, Family3))
#################################################
def relabel_the_outside(image,label_outside):
def relabel_the_outside(image,label_outside, rw):
""" if pixels outside the cylinder that contains the sample have the same value for air
they will be relabeled with the value label[1]
so, if you follow the conventions for label values
......@@ -167,7 +167,7 @@ def relabel_the_outside(image,label_outside):
# The cylinder is supposed to be the biggest "circle" inscribed in a squared image
z,x,y = np.shape(image)[0], np.shape(image)[1], np.shape(image)[2]
center = int(x/2), int(y/2)
radius = int(x/2)
radius = int(x/2)*rw
#Selecting circular ROI (region of interest)
mask_2D = sector_mask((x,y),center,radius,(0,360 ))
mask_3D = np.zeros(image.shape, dtype = np.bool)
......@@ -259,7 +259,7 @@ def add_message(message, list_messages_output, path_save, file_name):
frame.to_csv(name)
return(list_messages_output)
def compute_specific_surface_profile(start_VS, path_input, path_save, file_name, sample_name, label_outside, p1, p2, size_VS, resolution, flag_relabel=False, flag_SV=True, file_SV=None):
def compute_specific_surface_profile(start_VS, path_input, path_save, file_name, sample_name, label_outside, p1, p2, size_VS, resolution, flag_relabel=False, flag_SV=True, file_SV=None, rw = 1):
"""
The computation works like this:
The file (i.e. the image (file_name)) may have different labels for different phases
......@@ -298,7 +298,7 @@ def compute_specific_surface_profile(start_VS, path_input, path_save, file_name,
# Relabel (to avoid pixels outside the cylinder)
if flag_relabel == True:
image = relabel_the_outside(image, label_outside)
image = relabel_the_outside(image, label_outside, rw)
#chdir(path_save)
#tifffile.imsave('relabeled_{}'.format(file_name), image)
......@@ -367,7 +367,7 @@ def compute_specific_surface_profile(start_VS, path_input, path_save, file_name,
Frame['F3'] = F3s
Frame['Sur_Vox'] = num_sur_voxs
Name = 'SS_Profile_of_{}.csv'.format(sample_name)
Name = 'SS_Profile_of_{}_rw_{}.csv'.format(sample_name, rw)
Frame.to_csv(Name, sep = ';')
plot_ssp(path_save, Name)
......@@ -404,7 +404,8 @@ def main():
# Relabel ? (see relabel function)
flag_relabel = True
rw = 1
# size_VS
size_VS = 2 # pixels (the same lenght of the smoothing for volume fraction profiles)
......@@ -431,6 +432,7 @@ def main():
params.append(flag_relabel)
params.append(flag_SV)
params.append(file_SV)
params.append(rw)
compute_specific_surface_profile(*params)
main()
\ No newline at end of file
......@@ -146,7 +146,6 @@ def relabel_the_outside(image,labels, rw = None):
image[np.logical_not(mask_3D)] = labels[0] # outside the cilinder label = 1
print("{} pixels have been attributed to the phase : outside the cylinder".format(np.count_nonzero(image == 1)))
return image
def Compute_Volume_Fraction_Profile (path, path_save, image_name, sample_name, labels, neighbors, resolution, flag_TZ = False, lims = (None, None), flag_RAM_limitation = False, flag_relabel = False, rw = None):
""" Input Labels = list with int numbers that represent the phases of the image, in this version there are 4 phases
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment