vincentgao95 commited on
Commit
f386590
·
verified ·
1 Parent(s): 7e8b954

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -26,10 +26,16 @@ def visualize_slice(file_obj, slice_index, view):
26
  # Get the appropriate slice based on the selected view
27
  slice_image = get_slice(data, slice_index, view)
28
 
29
- # Rotate the image 90 degrees clockwise and flip it from left to right
30
  slice_image = np.rot90(slice_image, k=-1)
 
 
31
  slice_image = np.fliplr(slice_image)
32
 
 
 
 
 
33
  # Plot the slice
34
  fig, ax = plt.subplots()
35
  ax.imshow(slice_image, cmap='gray')
 
26
  # Get the appropriate slice based on the selected view
27
  slice_image = get_slice(data, slice_index, view)
28
 
29
+ # Rotate the image 90 degrees clockwise
30
  slice_image = np.rot90(slice_image, k=-1)
31
+
32
+ # Flip the image from left to right along the vertical axis
33
  slice_image = np.fliplr(slice_image)
34
 
35
+ # Flip the image from top to bottom along the horizontal axis for coronal and sagittal views
36
+ if view in ["Coronal", "Sagittal"]:
37
+ slice_image = np.flipud(slice_image)
38
+
39
  # Plot the slice
40
  fig, ax = plt.subplots()
41
  ax.imshow(slice_image, cmap='gray')