diff --git a/_modules/trx/fetcher.html b/_modules/trx/fetcher.html index eed9150..9dceb83 100644 --- a/_modules/trx/fetcher.html +++ b/_modules/trx/fetcher.html @@ -352,7 +352,7 @@
if 'TRX_HOME' in os.environ:
trx_home = os.environ['TRX_HOME']
else:
- trx_home = os.path.join(os.path.expanduser('~'), '.tee_ar_ex/')
+ trx_home = os.path.join(os.path.expanduser('~'), '.tee_ar_ex')
return trx_home
else:
if not isinstance(tractogram_obj, tmm.TrxFile):
tractogram_obj = tmm.TrxFile.from_sft(tractogram_obj)
- tmm.save(tractogram_obj, tractogram_filename)
"An undeclared group ({}) has " "data_per_group.".format(
dpg)
)
-
return trx
dtype_size = np.dtype(ext[1:]).itemsize
size = os.path.getsize(elem_filename) / dtype_size
-
if size.is_integer():
files_pointer_size[elem_filename] = 0, int(size)
elif os.path.getsize(elem_filename) == 1:
@@ -923,7 +921,6 @@ Source code for trx.trx_file_memmap
copy_trx = trx.deepcopy()
copy_trx.resize()
-
tmp_dir_name = copy_trx._uncompressed_folder_handle.name
if ext in [".zip", ".trx"]:
zip_from_folder(tmp_dir_name, filename, compression_standard)
@@ -950,11 +947,11 @@ Source code for trx.trx_file_memmap
"""
with zipfile.ZipFile(filename, mode="w", compression=compression_standard) as zf:
- for root, dirs, files in os.walk(directory):
+ for root, _, files in os.walk(directory):
for name in files:
- tmp_filename = os.path.join(root, name)
- zf.write(tmp_filename, tmp_filename.replace(
- directory + "/", ""))
+ curr_filename = os.path.join(root, name)
+ tmp_filename = curr_filename.replace(directory, "")[1:]
+ zf.write(curr_filename, tmp_filename)
@@ -1490,9 +1487,11 @@ Source code for trx.trx_file_memmap
# This is for Unix
if os.name != 'nt' and folder.startswith(root.rstrip("/")):
folder = folder.replace(root, "").lstrip("/")
- # These two are for Windows
- elif os.path.isdir(folder) and os.path.basename(folder) in ['dpg', 'dpv', 'dps']:
+ # These three are for Windows
+ elif os.path.isdir(folder) and os.path.basename(folder) in ['dpv', 'dps', 'groups']:
folder = os.path.basename(folder)
+ elif os.path.basename(os.path.dirname(folder)) == 'dpg':
+ folder = os.path.join('dpg', os.path.basename(folder))
else:
folder = ''
@@ -2030,6 +2029,7 @@ Source code for trx.trx_file_memmap
save(trx, tmp_dir.name)
trx.close()
trx = load_from_directory(tmp_dir.name)
+ trx._uncompressed_folder_handle = tmp_dir
sft.to_space(old_space)
sft.to_origin(old_origin)
diff --git a/_modules/trx/workflows.html b/_modules/trx/workflows.html
index dc2adb5..658287b 100644
--- a/_modules/trx/workflows.html
+++ b/_modules/trx/workflows.html
@@ -389,7 +389,7 @@ Source code for trx.workflows
f_out.writelines(f_in)
sft = load_tractogram('tmp.trk', 'same',
bbox_valid_check=False)
- os.remove('tmp.trk')
+ os.remove('tmp.trk')
elif in_ext == '.trk':
sft = load_tractogram(in_dsi_tractogram, 'same',
bbox_valid_check=False)
@@ -603,7 +603,7 @@ Source code for trx.workflows
if not isinstance(tractogram_obj, StatefulTractogram):
sft = tractogram_obj.to_sft()
- tractogram_obj.close()
+ # tractogram_obj.close()
else:
sft = tractogram_obj
@@ -761,7 +761,6 @@ Source code for trx.workflows
curr_filename = os.path.join(tmp_dir_name, 'dps', '{}.{}{}'.format(
os.path.basename(os.path.splitext(arg[0])[0]), dim, arg[1]))
curr_arr.tofile(curr_filename)
-
if groups:
os.mkdir(os.path.join(tmp_dir_name, 'groups'))
for arg in groups: