Skip to content

Commit

Permalink
save more info
Browse files Browse the repository at this point in the history
  • Loading branch information
skoudoro committed Aug 3, 2023
1 parent f74a232 commit dd45122
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions quantconn/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def merge(destination: Annotated[Path, typer.Option("--destination", "-dest",
'score': [conn_mat[i+1]]})
df_conn = pd.concat([df_conn, df_conn_2])

df_conn.to_csv(pjoin(destination, '_connectome_summary.csv'))
np.savetxt(_merging_results_path, np.asarray(_merging_results),
delimiter=',', header=','.join(headers), fmt='%s')

Expand All @@ -242,6 +243,9 @@ def merge(destination: Annotated[Path, typer.Option("--destination", "-dest",
'score': [data[mt][i]]})
df_ss = pd.concat([df_ss, df_ss_2])

df_mm.to_csv(pjoin(destination, '_microstructural_measures_scores.csv'))
df_ss.to_csv(pjoin(destination, '_shape_similarity_scores.csv'))

results_mm = pg.intraclass_corr(data=df_mm, targets='# subject',
raters='metric', ratings='score')
results_mm = results_mm.set_index('Description')
Expand All @@ -257,8 +261,8 @@ def merge(destination: Annotated[Path, typer.Option("--destination", "-dest",
# Save results
with open(pjoin(destination, '_final_sore.csv'), 'w') as fh:
writer = csv.writer(fh, delimiter=',')
writer.writerow(['betweenness_centrality', 'global_efficiency',
'modularity'])
writer.writerow(['Connectivity score', 'Microstructural measures',
'Shape Similarity'])
writer.writerow([float(icc_con.round(3)),
float(icc_mm.round(3)),
float(icc_ss.round(3))])
Expand Down
2 changes: 2 additions & 0 deletions quantconn/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def process_data(nifti_fname, bval_fname, bvec_fname, t1_fname, output_path,
tensor_vals = lower_triangular(tenfit.quadratic_form)
ten_img = nifti1_symmat(tensor_vals, affine=resliced_affine)

# TODO: flipping -> xx xy xz yy yz zz -> xx xy yy xz yx zz
# new_D = permute(D,[1 2 4 3 5 6])
save_nifti(pjoin(output_path, 'tensors.nii.gz'),
ten_img.get_fdata().squeeze(), resliced_affine)

Expand Down

0 comments on commit dd45122

Please sign in to comment.