fr1ll commited on
Commit
e6bb3be
·
verified ·
1 Parent(s): 5381a8a

Set npx to nh why not

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -16,8 +16,8 @@ def compute_radon_fn(image,
16
  taxis = np.linspace(-nt/2, nt/2, nt) # time axis (rows)
17
  haxis = np.linspace(-nh/2, nh/2, nh) # spatial axis (columns)
18
  # Set detector axis (pxaxis) to cover the full image diagonal.
19
- # L = int(np.ceil(np.sqrt(M**2 + N**2)))
20
- npx = nt # why?
21
  pxaxis = np.linspace(-npx/2, npx/2, npx)
22
 
23
  print(f"Shapes:\n taxis:{taxis.shape}, haxis:{haxis.shape}, pxaxis:{pxaxis.shape}")
@@ -30,9 +30,9 @@ def compute_radon_fn(image,
30
  # Compute the forward radon transform.
31
  radon_data_flat = R.dot(image_gray.flatten())
32
  # Deduce the number of projections from the operator shape.
33
- nproj = R.shape[0] // L
34
  # Reshape to (nproj, L) so each row corresponds to one projection.
35
- radon_data = radon_data_flat.reshape((nproj, L))
36
 
37
  # Transpose for display: p (detector coordinate) on x-axis, τ on y-axis.
38
  radon_display = radon_data.T
@@ -44,7 +44,7 @@ def compute_radon_fn(image,
44
  "radon_data": radon_data, # shape: (nproj, L)
45
  "image_shape": image_gray.shape,
46
  "R": R, # the Radon2D operator
47
- "L": L # detector length
48
  }
49
  return radon_display, state
50
 
 
16
  taxis = np.linspace(-nt/2, nt/2, nt) # time axis (rows)
17
  haxis = np.linspace(-nh/2, nh/2, nh) # spatial axis (columns)
18
  # Set detector axis (pxaxis) to cover the full image diagonal.
19
+ # npx = int(np.ceil(np.sqrt(nt**2 + nh**2)))
20
+ npx = nh # why?
21
  pxaxis = np.linspace(-npx/2, npx/2, npx)
22
 
23
  print(f"Shapes:\n taxis:{taxis.shape}, haxis:{haxis.shape}, pxaxis:{pxaxis.shape}")
 
30
  # Compute the forward radon transform.
31
  radon_data_flat = R.dot(image_gray.flatten())
32
  # Deduce the number of projections from the operator shape.
33
+ nproj = R.shape[0] // npx
34
  # Reshape to (nproj, L) so each row corresponds to one projection.
35
+ radon_data = radon_data_flat.reshape((nproj, npx))
36
 
37
  # Transpose for display: p (detector coordinate) on x-axis, τ on y-axis.
38
  radon_display = radon_data.T
 
44
  "radon_data": radon_data, # shape: (nproj, L)
45
  "image_shape": image_gray.shape,
46
  "R": R, # the Radon2D operator
47
+ "L": npx # detector length
48
  }
49
  return radon_display, state
50