Skip to content

Commit

Permalink
fixed up ImagingSession.save
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Feb 12, 2024
1 parent 57a5055 commit 22b584b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions xnat_ingest/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import logging
import os.path
import subprocess as sp
from copy import deepcopy
from functools import cached_property
import shutil
import yaml
Expand Down Expand Up @@ -384,16 +383,16 @@ def save(self, save_dir: Path) -> "ImagingSession":
# If data is not already in the save directory, copy it there
if not fileset.parent.is_relative_to(resource_dir):
resource_dir.mkdir(parents=True, exist_ok=True)
fileset_copy = fileset.copy(
fileset = fileset.copy(
resource_dir, mode=fileset.CopyMode.hardlink_or_copy
)
self.scans[scan.id].resources[resource_name] = fileset_copy
self.scans[scan.id].resources[resource_name] = fileset
resources_dict[resource_name] = {
"datatype": to_mime(fileset, official=False),
"fspaths": [
# Ensure it is a relative path using POSIX forward slashes
str(p.relative_to(save_dir)).replace("\\", "/")
for p in fileset_copy.fspaths
for p in fileset.fspaths
],
}
dct["scans"][scan.id] = {
Expand Down

0 comments on commit 22b584b

Please sign in to comment.