Skip to content

Commit

Permalink
FIX save surf2surf matrix with surface_type in filename (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdoc authored Nov 20, 2023
1 parent 01afec1 commit a93485c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions cortex/database.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
"""
Contains a singleton object `db` of type `Database` which allows easy access to surface files, anatomical images, and transforms that are stored in the pycortex filestore.
"""
import os
import re
import copy
import functools
import glob
import json
import os
import re
import shutil
import warnings
import tempfile
import functools
import numpy as np
from hashlib import sha1
import warnings
from builtins import input
from hashlib import sha1

import numpy as np

from . import options

Expand Down Expand Up @@ -318,7 +319,11 @@ def get_mri_surf2surf_matrix(self, subject, surface_type, hemi='both',
from .utils import load_sparse_array, save_sparse_array
if fs_subj is None:
fs_subj = subject
fpath = self.get_paths(subject)['surf2surf'].format(source=fs_subj, target=target_subj)
fpath = self.get_paths(subject)['surf2surf'].format(
source=fs_subj,
target=target_subj,
surface_type=surface_type
)
# Backward compatibility
fdir, _ = os.path.split(fpath)
if not os.path.exists(fdir):
Expand Down Expand Up @@ -686,7 +691,7 @@ def get_paths(self, subject):
rois=os.path.join(self.filestore, subject, "rois.svg").format(subj=subject),
overlays=os.path.join(self.filestore, subject, "overlays.svg").format(subj=subject),
views=sorted([os.path.splitext(f)[0] for f in views]),
surf2surf=os.path.join(self.filestore, subject, "surf2surf", "{source}_to_{target}", "matrices.hdf"),
surf2surf=os.path.join(self.filestore, subject, "surf2surf", "{source}_to_{target}", "matrices_{surface_type}.hdf"),
)

return filenames
Expand Down

0 comments on commit a93485c

Please sign in to comment.