Skip to content

Commit

Permalink
set ModeOfAdministration to lower
Browse files Browse the repository at this point in the history
  • Loading branch information
bendhouseart committed Dec 9, 2024
1 parent 17b0a3c commit 684e407
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 14 deletions.
5 changes: 5 additions & 0 deletions matlab/updatejsonpetfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@
end
filemetadata = update_arrays(filemetadata);

% set ModeOfAdministration to lower case
if isfield(filemetadata,'ModeOfAdministration')
filemetadata.ModeOfAdministration = lower(filemetadata.ModeOfAdministration);
end

% clean-up
fn_check = fieldnames(filemetadata);
for f=1:size(fn_check,1)
Expand Down
54 changes: 42 additions & 12 deletions pypet2bids/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pypet2bids/pypet2bids/dcm2niix4pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,16 @@ def run_dcm2niix(self):
sidecar_json.update(self.spreadsheet_metadata.get("nifti_json", {}))
sidecar_json.update(self.additional_arguments)

# set ModeOfAdministration to lower case
if sidecar_json.get("ModeOfAdministration"):
sidecar_json.update(
{
"ModeOfAdministration": sidecar_json.get(
"ModeOfAdministration"
).lower()
}
)

# this is mostly for ezBIDS, but it helps us to make better use of the series description that
# dcm2niix generates by default for PET imaging
collect_these_fields = {
Expand Down
6 changes: 6 additions & 0 deletions pypet2bids/pypet2bids/ecat.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@ def populate_sidecar(self, **kwargs):
meta_radio_inputs = check_meta_radio_inputs(self.sidecar_template)
self.sidecar_template.update(**meta_radio_inputs)

# set ModeOfAdministration to lower case
if self.sidecar_template.get("ModeOfAdministration", ""):
self.sidecar_template["ModeOfAdministration"] = self.sidecar_template[
"ModeOfAdministration"
].lower()

def prune_sidecar(self):
"""
Eliminate unpopulated fields in sidecar while leaving in mandatory fields even if they are unpopulated.
Expand Down
5 changes: 4 additions & 1 deletion pypet2bids/pypet2bids/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def telemetry_enabled(config_path=None):
load_dotenv(dotenv_path=config_file)

# check to see if telemetry is disabled
if os.getenv("PET2BIDS_TELEMETRY_ENABLED", "").lower() == "false" or os.getenv("CI", "false") == "true":
if (
os.getenv("PET2BIDS_TELEMETRY_ENABLED", "").lower() == "false"
or os.getenv("CI", "false") == "true"
):
return False
else:
return True
Expand Down
2 changes: 1 addition & 1 deletion pypet2bids/tests/test_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def test_reorder_isotope():
"11C": ["C11", "^11^C", "C-11", "11-C", "11C", "c11", "c-11", "11c"],
"18F": ["F18", "^18^F", "F-18", "18-F", "18F"],
"68Ga": ["Ga68", "^68^Ga", "Ga-68", "68-Ga", "68Ga"],
"52mMn": ["Mn52m", "Mn-52m", "52m-Mn", "52mMn"]
"52mMn": ["Mn52m", "Mn-52m", "52m-Mn", "52mMn"],
}

for isotope, isotope_variants in isotopes.items():
Expand Down

0 comments on commit 684e407

Please sign in to comment.