FrancescoLR commited on
Commit
ad860e3
·
verified ·
1 Parent(s): 61e3293

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -166,7 +166,11 @@ def extract_middle_slices(nifti_path, output_image_path, slice_size=180, center=
166
 
167
  # Choose colormap
168
  if label_components:
169
- cmap = plt.cm.Pastel1 # Colorful
 
 
 
 
170
  vmin = 0
171
  vmax = num_features
172
  else:
 
166
 
167
  # Choose colormap
168
  if label_components:
169
+ # Build a modified Pastel colormap with 0 = black
170
+ pastel = plt.cm.Pastel2(np.linspace(0, 1, 256))
171
+ pastel[0] = np.array([0, 0, 0, 1]) # Set the first color (label 0) to black (RGBA)
172
+ custom_cmap = mpl.colors.ListedColormap(pastel)
173
+ cmap = custom_cmap # Colorful
174
  vmin = 0
175
  vmax = num_features
176
  else: