Skip to content

Commit

Permalink
319 standardize radiochemistry metadata caseorder (#325)
Browse files Browse the repository at this point in the history
* set ModeOfAdministration to lower
* bump version
  • Loading branch information
bendhouseart authored Dec 9, 2024
1 parent 3d39ffb commit 525cf1c
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 16 deletions.
6 changes: 1 addition & 5 deletions matlab/dcm2niix4pet.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ function dcm2niix4pet(FolderList,MetaList,varargin)
end
end



%% convert
% ----------
for folder = 1:size(FolderList,1)
Expand Down Expand Up @@ -271,10 +269,8 @@ function dcm2niix4pet(FolderList,MetaList,varargin)
telemetry_data.returncode = 1;
telemetry(telemetry_data, folder);
error('%s did not run properly',command)

end



% deal with dcm files
dcmfiles = dir(fullfile(FolderList{folder},'*.dcm'));
if isempty(dcmfiles) % since sometimes they have no ext :-(
Expand Down
2 changes: 1 addition & 1 deletion matlab/telemetry.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function telemetry(telemetry_data, input_path, output_path)

% if running in CI don't run telemetry
running_in_ci = strcmpi(getenv("CI"), 'true');

if disable_telemetry | disable_telemetry_env | running_in_ci
e = false;
else
Expand Down
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
46 changes: 38 additions & 8 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/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pypet2bids"
version = "1.3.14"
version = "1.3.15"
description = "A python library for converting PET imaging and blood data to BIDS."
authors = ["anthony galassi <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 525cf1c

Please sign in to comment.