Skip to content

Commit 01997ec

Browse files
Add logs
1 parent 8bdf975 commit 01997ec

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

postprocess/postprocess_service.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,20 @@ def get_all_correlations(self, path, ids: List[str]) -> pd.DataFrame:
3333
for conf_id in ids:
3434
niis[conf_id] = os.path.join(path, conf_id, '_subject_id_01', 'result.nii')
3535

36+
size = len(niis)
37+
count = 0
3638
for id_src in niis:
39+
count += 1
3740
for id_tgt in niis:
3841
# This correlation may have already been calculated the other way
3942
if ((dataframe['source'] == id_tgt) & (dataframe['target'] == id_src)).any():
40-
corr = dataframe.loc[(dataframe['source'] == id_tgt) & (dataframe['target'] == id_src), 'correlation'].values[0]
43+
corr = dataframe.loc[
44+
(dataframe['source'] == id_tgt) & (dataframe['target'] == id_src), 'correlation'].values[0]
4145
else:
4246
corr = self.corr_srv.get_correlation_coefficient(niis[id_tgt], niis[id_src], 'spearman')
43-
pd.concat([dataframe, pd.DataFrame([{'source': id_src, 'target': id_tgt, 'correlation': corr}])], ignore_index=True)
44-
47+
pd.concat([dataframe, pd.DataFrame([{'source': id_src, 'target': id_tgt, 'correlation': corr}])],
48+
ignore_index=True)
49+
print(f'Computed correlations for [{count} / {size}] images')
4550
return dataframe.sort_values(by='correlation', ascending=False)
4651

4752
def get_mean_image(self, inputs: list, batch_size: int) -> nib.Nifti1Image:

0 commit comments

Comments
 (0)