Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

319 standardize radiochemistry metadata caseorder #325

Merged
merged 22 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c6c6df5
added telemetry call
bendhouseart Jul 18, 2024
5a84ebb
added file count to telemetery tracking for dcm2niix
bendhouseart Jul 19, 2024
6b53ba4
added python functionality
bendhouseart Jul 24, 2024
b3bf9af
matlab is being weird and not finding dcm2niix on path
bendhouseart Aug 1, 2024
8550942
added telemetry to matlab converters
bendhouseart Aug 2, 2024
272780a
fixe typo, bump version
bendhouseart Aug 2, 2024
62791ec
added option to opt out of telemetry
bendhouseart Aug 7, 2024
e60aa57
added cli flag and environment variable disabling of telemetry
bendhouseart Aug 12, 2024
ff3645d
updating matlab to suit passing of --notrack to conversion functions
bendhouseart Aug 12, 2024
400fec2
update tracking on matlab to set env to not track if provided via arg…
bendhouseart Aug 12, 2024
5903752
finished setting up matlab version
bendhouseart Aug 12, 2024
4b4928a
fix error with loading config
bendhouseart Aug 14, 2024
9bc9e56
automated message was more errofr that it's worth
bendhouseart Aug 14, 2024
b360317
formatted files
bendhouseart Aug 14, 2024
878d4ac
add try catch for .env file check on telemetry.m
bendhouseart Aug 15, 2024
29e32a4
update poetry lock file
bendhouseart Aug 16, 2024
f312bbd
added reordering for Isotope Number
bendhouseart Aug 16, 2024
349ef31
bump version, update url for telemetry
bendhouseart Sep 12, 2024
0135f6d
Merge branch '263-telementry-add-tracking-of-code-usage' into 319-sta…
bendhouseart Sep 12, 2024
17b0a3c
Merge branch 'main' of github.com:openneuropet/PET2BIDS into 319-stan…
bendhouseart Dec 9, 2024
684e407
set ModeOfAdministration to lower
bendhouseart Dec 9, 2024
9d9e987
bump version
bendhouseart Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <28850131+bendhouseart@users.noreply.github.com>"]
license = "MIT"
Expand Down
Loading