diff --git a/README.md b/README.md index 695f82e..81fe248 100644 --- a/README.md +++ b/README.md @@ -49,4 +49,4 @@ Output of flags `g`, `t`, and `p` is saved at the data location in a new folder # Dependencies -The program requires `numpy`, `scipy`, and `scikit-image`. +The program requires `numpy`, `scipy`, `scikit-image`, `matplotlib`, `pandas`, and `happy-tools`. diff --git a/find_optimal_frames.py b/find_optimal_frames.py index 1b74a39..67691ff 100644 --- a/find_optimal_frames.py +++ b/find_optimal_frames.py @@ -11,9 +11,9 @@ import numpy as np import scipy.signal import matplotlib.pyplot as plt -from . import metadata -from . import motion_metrics -from . import ultrasound_utils +import metadata +import motion_metrics +import ultrasound_utils from pathlib import Path @@ -484,6 +484,8 @@ def process_scan(ultrasound, metadata_filename, strict=None, ## Find peaks peaks = scipy.signal.find_peaks(-results, distance=max(1,len(results)//distance))[0] sorted_peaks = peaks[np.argsort(results[peaks])] + if len(sorted_peaks) == 0: + sorted_peaks = np.argsort(results)[0:len(results)//distance:] return sorted_peaks, results