Skip to content

Commit 4bb20c7

Browse files
Address CodeRabbit review comments
- Improve FFT shift comment for clarity - Add Args and Returns sections to RadialFourierFeatures3D.__call__ method - Maintain all existing functionality
1 parent 8e74eb4 commit 4bb20c7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

monai/transforms/signal/radial_fourier.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
186186
if len(spatial_shape) != 3:
187187
raise ValueError("Expected 3 spatial dimensions")
188188

189-
# Compute 3D FFT
190-
# Shift zero frequency to center and compute FFT
189+
# Compute 3D FFT with proper frequency centering
190+
# Apply ifftshift to input to align with FFT convention, then fftshift output to center zero frequency
191191
spectrum = fftn(ifftshift(img_tensor, dim=self.spatial_dims), dim=self.spatial_dims)
192192
spectrum = fftshift(spectrum, dim=self.spatial_dims)
193193

@@ -375,7 +375,15 @@ def __init__(
375375
self.transforms.append(transform)
376376

377377
def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
378-
"""Extract radial Fourier features."""
378+
"""
379+
Extract radial Fourier features.
380+
381+
Args:
382+
img: input medical image data. Expected shape: (..., D, H, W).
383+
384+
Returns:
385+
Concatenated feature vector with shape (..., total_features).
386+
"""
379387
features = []
380388
for transform in self.transforms:
381389
feat = transform(img)

0 commit comments

Comments
 (0)