Skip to content

Commit

Permalink
Merge branch 'Aswendt-Lab:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Danyyyel authored Aug 30, 2024
2 parents 2faebc9 + 64dec2e commit f08f9c4
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 1 deletion.
24 changes: 24 additions & 0 deletions bin/2.2_DTIPreProcessing/registration_DTI.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,30 @@ def regABA2DTI(inputVolume,stroke_mask,refStroke_mask,T2data, brain_template,bra
print(f'Error while executing the command: {command_args}Errorcode: {str(e)}')
raise


# resample subject to template
# Step 1: Invert the affine matrix
inverted_aff = os.path.join(outfile, os.path.basename(inputVolume).split('.')[0] + '_invertedAffine.txt')
command = f"reg_transform -invAff {outputAff} {inverted_aff}"
command_args = shlex.split(command)
try:
result = subprocess.run(command_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
print(f"Output of {command}:\n{result.stdout}")
except Exception as e:
print(f'Error while executing the command: {command_args} Errorcode: {str(e)}')
raise

# Step 2: Resample subject to template using the inverted affine matrix
outputTemplate = os.path.join(outfile, os.path.basename(inputVolume).split('.')[0] + '_SubjectOnTemplate.nii.gz')
command = f"reg_resample -ref {brain_template} -flo {inputVolume} -trans {inverted_aff} -res {outputTemplate}"
command_args = shlex.split(command)
try:
result = subprocess.run(command_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
print(f"Output of {command}:\n{result.stdout}")
except Exception as e:
print(f'Error while executing the command: {command_args} Errorcode: {str(e)}')
raise

# Some scaled data for DSI Studio
outfileDSI = os.path.join(os.path.dirname(inputVolume), 'DSI_studio')
if os.path.exists(outfileDSI):
Expand Down
24 changes: 23 additions & 1 deletion bin/2.3_fMRIPreProcessing/registration_rsfMRI.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,29 @@ def regABA2rsfMRI(inputVolume, T2data, brain_template, brain_anno, splitAnno, sp
except Exception as e:
print(f'Error while executing the command: {command_args}\Errorcode: {str(e)}')
raise


# resample subject to template
# Step 1: Invert the affine matrix
inverted_aff = os.path.join(outfile, os.path.basename(inputVolume).split('.')[0] + '_invertedAffine.txt')
command = f"reg_transform -invAff {outputAff} {inverted_aff}"
command_args = shlex.split(command)
try:
result = subprocess.run(command_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
print(f"Output of {command}:\n{result.stdout}")
except Exception as e:
print(f'Error while executing the command: {command_args} Errorcode: {str(e)}')
raise

# Step 2: Resample subject to template using the inverted affine matrix
outputTemplate = os.path.join(outfile, os.path.basename(inputVolume).split('.')[0] + '_SubjectOnTemplate.nii.gz')
command = f"reg_resample -ref {brain_template} -flo {inputVolume} -trans {inverted_aff} -res {outputTemplate}"
command_args = shlex.split(command)
try:
result = subprocess.run(command_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
print(f"Output of {command}:\n{result.stdout}")
except Exception as e:
print(f'Error while executing the command: {command_args} Errorcode: {str(e)}')
raise

return outputAnnoSplit

Expand Down
143 changes: 143 additions & 0 deletions codemeta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"@context": "https://w3id.org/codemeta/3.0",
"type": "SoftwareSourceCode",
"applicationCategory": "Neuroscience",
"codeRepository": "https://github.com/Aswendt-Lab/AIDAmri",
"contributor": [
{
"id": "_:contributor_1",
"type": "Person",
"affiliation": {
"type": "Organization",
"name": "Department of Neurology, Faculty of Medicine and University Hospital Cologne, University of Cologne, Cologne, Germany"
},
"email": "[email protected]",
"familyName": "Pallast",
"givenName": "Niklas"
},
{
"type": "Role",
"contributor": "_:contributor_1",
"endDate": "2020-03-12",
"roleName": "Developer",
"startDate": "2017-08-10"
},
{
"id": "_:contributor_2",
"type": "Person",
"affiliation": {
"type": "Organization",
"name": "Department of Neurology, Faculty of Medicine and University Hospital Cologne, University of Cologne, Cologne, Germany"
},
"email": "[email protected]",
"familyName": "Scharwächter",
"givenName": "Leon"
},
{
"type": "Role",
"contributor": "_:contributor_2",
"endDate": "2021-08-31",
"roleName": "Developer",
"startDate": "2020-04-01"
},
{
"id": "_:contributor_3",
"type": "Person",
"affiliation": {
"type": "Organization",
"name": "Department of Neurology, Faculty of Medicine and University Hospital Cologne, University of Cologne, Cologne, Germany"
},
"email": "[email protected]",
"familyName": "Vera Frazao",
"givenName": "Victor"
},
{
"type": "Role",
"contributor": "_:contributor_3",
"endDate": "2024-06-25",
"roleName": "Developer",
"startDate": "2021-09-07"
},
{
"id": "_:contributor_4",
"type": "Person",
"affiliation": {
"type": "Organization",
"name": "Department of Neurology, Faculty of Medicine and University Hospital Cologne, University of Cologne, Cologne, Germany"
},
"email": "[email protected]",
"familyName": "Schneider",
"givenName": "Marc"
},
{
"type": "Role",
"contributor": "_:contributor_4",
"endDate": "2024-03-27",
"roleName": "Developer",
"startDate": "2023-10-19"
},
{
"id": "_:contributor_5",
"type": "Person",
"affiliation": {
"type": "Organization",
"name": "Department of Neurology, Faculty of Medicine and University Hospital Cologne, University of Cologne, Cologne, Germany"
},
"email": "[email protected]",
"familyName": "Kalantari",
"givenName": "Aref"
},
{
"type": "Role",
"contributor": "_:contributor_5",
"endDate": "2024-08-27",
"roleName": "Developer",
"startDate": "2023-11-07"
},
{
"id": "_:contributor_6",
"type": "Person",
"affiliation": {
"type": "Organization",
"name": "Department of Neurology, Faculty of Medicine and University Hospital Cologne, University of Cologne, Cologne, Germany"
},
"email": "[email protected]",
"familyName": "Aswendt",
"givenName": "Markus"
},
{
"type": "Role",
"contributor": "_:contributor_6",
"endDate": "2024-08-27",
"roleName": "Developer",
"startDate": "2018-11-29"
}
],
"dateCreated": "2017-08-10",
"dateModified": "2024-01-22",
"datePublished": "2018-10-19",
"description": "Dockerized Atlas-based Imaging Data Analysis Pipeline (AIDA) for structural and functional MRI of the mouse brain. Accepts Bruker raw data, BIDS and Nifty files as input. Performs a range of data conversion and pre-processing steps including the multi-step registration with the Allen Mouse Brain Atlas. ",
"downloadUrl": "https://github.com/Aswendt-Lab/AIDAmri/releases/tag/v2.0",
"funder": {
"type": "Organization",
"name": "Friebe Foundation"
},
"keywords": [
"MRI",
"mouse brain",
"atlas registration",
"rs-fMRI",
"DTI",
"connectivity"
],
"license": "https://spdx.org/licenses/GPL-3.0",
"name": "AIDAmri",
"operatingSystem": "OS-independent Docker",
"programmingLanguage": "Python 3.7",
"releaseNotes": "Introducing the Brain Imaging Data Structure (BIDS) to improve and standardize data organisation\nImproved batch processing, including independent T2 mapping\nParallel computing for faster processing\nCleaner processing output stream and verbose logging",
"softwareRequirements": "Docker",
"version": "2.0",
"developmentStatus": "active",
"funding": "T0498/28960/16",
"referencePublication": "ttps://doi.org/10.3389/fninf.2019.00042"
}

0 comments on commit f08f9c4

Please sign in to comment.