-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refractor derivatives naming convention (#159)
* add preprocessed data * add labels_softseg_bin in derivatives * add space-other * change suffix * add disc labels for MTS, T2star and DWI * modify/add json file with space other * remove space-other for disc labels * add dwi json * reorient T2star * update code to create json * remove duplicates of softseg to adress issue 151 * change GM name * change C2 to C3 * fix wrong qform and sform * fix qform and sform * redo discs and fix orientation to seg * fix disc label * set sform as qform * Reorient to RPI seg of MTS data and cpy qform to sform * Re upload preprocessed data after fresh preprocessing (#161) * add updated labels softseg bin * add updated softseg labels * add preprocessed images * rm excluded participants * update with script and release tag * update readme with release of code
- Loading branch information
1 parent
5398c0f
commit af1f9e2
Showing
20,031 changed files
with
134,968 additions
and
11,942 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import os | ||
import json | ||
import argparse | ||
|
||
|
||
def get_parser(): | ||
parser = argparse.ArgumentParser( | ||
description="Adds spatial reference information to json sidecars." ) | ||
parser.add_argument('-d', | ||
required=True, help='Directory to process JSON files in') | ||
parser.add_argument('-r', | ||
default='0.8x0.8x0.8', | ||
help='Resampling factor to add to SpatialReference') | ||
|
||
return parser | ||
|
||
|
||
def create_json_file(nii_gz_files, resampling_factor): | ||
"""Creates a JSON file listing all .nii.gz files and includes the resampling factor. | ||
Args: | ||
nii_gz_files (list): A list of paths to .nii.gz files. | ||
""" | ||
data = { | ||
#"SpatialReference": { | ||
# "Orientation": "RPI", | ||
# "Resampling": resampling_factor, | ||
# }, | ||
"GeneratedBy":[ | ||
{ | ||
"Name": "sct_dmri_moco", | ||
"Version": "SCT v6.1", | ||
#"Author": "Paul Bautin", | ||
#"Date": "2020-07-30 11:57:54", | ||
"Description": "Mean image across directions after motion correction" | ||
}] | ||
} | ||
for file in nii_gz_files: | ||
output_path = file.replace('.nii.gz', '.json') | ||
with open(output_path, 'w', encoding='utf-8') as file: | ||
json.dump(data, file, indent=4) | ||
|
||
|
||
def add_spatial_reference(file_path, resampling_factor): | ||
"""Adds the SpatialReference field to a JSON file. | ||
Args: | ||
file_path (str): The path to the JSON file. | ||
""" | ||
with open(file_path, 'r+', encoding='utf-8') as file: | ||
# Load the existing data | ||
data = json.load(file) | ||
|
||
# Add the "SpatialReference" field | ||
data["SpatialReference"] = { | ||
"Resampling": resampling_factor, | ||
"Reorientation": "RPI", | ||
"Other": "root-mean square across 4th dimension (if it exists)" | ||
} | ||
|
||
# Reset file pointer to the beginning and truncate the file | ||
file.seek(0) | ||
file.truncate() | ||
|
||
# Write the modified data back to the file | ||
json.dump(data, file, indent=4) | ||
|
||
|
||
def find_nii_gz_files(directory): | ||
"""Finds all .nii.gz files in a directory and its subdirectories. | ||
Args: | ||
directory (str): The root directory to start the search from. | ||
Returns: | ||
list: A list of paths to the .nii.gz files found. | ||
""" | ||
nii_gz_files = [] | ||
for root, _, files in os.walk(directory): | ||
for file in files: | ||
if ('rec-average_dwi.nii.gz' in file): | ||
nii_gz_files.append(os.path.join(root, file)) | ||
|
||
return nii_gz_files | ||
|
||
|
||
def process_directory(directory, resampling_factor): | ||
"""Recursively processes directories to find and update JSON files. | ||
Args: | ||
directory (str): The root directory to start the search from. | ||
""" | ||
for root, _, files in os.walk(directory): | ||
for file in files: | ||
if ('T2w' in file) and ('.json' in file): | ||
file_path = os.path.join(root, file) | ||
add_spatial_reference(file_path, resampling_factor) | ||
print(f"Updated {file_path}") | ||
|
||
def main(): | ||
parser = get_parser() | ||
args = parser.parse_args() | ||
#process_directory(args.d, args.r) | ||
nii_gz_files = find_nii_gz_files(args.d) | ||
create_json_file(nii_gz_files, args.r) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
This folder contains the preprocessed images using [process_data.sh](https://github.com/spine-generic/spine-generic/blob/v2.7/process_data.sh). The preprocessing steps include: | ||
|
||
T2w: | ||
* Resampling to 0.8x0.8x0.8 mm | ||
* Reorientation to RPI | ||
T1w: | ||
* Resampling to 1x1x1 mm | ||
* Reorientation to RPI | ||
T2star: | ||
* Reorientation to RPI | ||
* Root-mean square across 4th dimension (if exists) | ||
|
||
MTS (flip-1_mt-on & flip-2_mt-off): | ||
* Reorientation to RPI | ||
|
||
DWI: | ||
* Motion correction | ||
* Avreage across 4th dimension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"Name": "Spinal Cord MRI Public Database (Multi-subjects)", | ||
"BIDSVersion": "1.2.0", | ||
"License": "CC0", | ||
"Authors": [ | ||
"J. Cohen-Adad", | ||
"M. Abramovic", | ||
"C. Arneitz", | ||
"L. Barlow", | ||
"B. De Leener", | ||
"J. Doyon", | ||
"F. Eippert", | ||
"J. Finsterbusch", | ||
"A. Hagiwara", | ||
"K. Kamiya", | ||
"H. Karbasforoushan", | ||
"A. Khatibi", | ||
"N. Kinany", | ||
"S. Kusmia", | ||
"C. Laule", | ||
"T. Leutritz", | ||
"E. Martinez-Heras", | ||
"D. Papp", | ||
"M. Seif", | ||
"Y. Suzuki", | ||
"G. Tackley", | ||
"A. Tinnermann", | ||
"N. Weiskopf", | ||
"R. Wise", | ||
"A. V. Dvorak", | ||
"S. Kolind", | ||
"S. Smith", | ||
"B. Landman", | ||
"K. O\u2019Grady", | ||
"A. Combes", | ||
"P. Freund", | ||
"Y. Kong", | ||
"Y. Liu", | ||
"Y. Duan", | ||
"T. Hor\u00e1k", | ||
"P. Kudli\u010dka", | ||
"J. Valo\u0161ek", | ||
"K. Paul", | ||
"L. Mattera", | ||
"D. Van De Ville", | ||
"M.M. Lagan\u00e0", | ||
"A. Smith", | ||
"N.D. Kurniawan", | ||
"M.J. Ruitenberg", | ||
"M. Barth", | ||
"N. Atcheson", | ||
"P.-G. Henry", | ||
"J. Joers", | ||
"R. Labounek", | ||
"C. Lenglet", | ||
"I. Nestrasil", | ||
"T. Parrish", | ||
"Z. Smith\u00a0", | ||
"A. Foias", | ||
"R.L. Barry", | ||
"G. Savini", | ||
"J. Xu", | ||
"A. Seifert", | ||
"J-W. Kim", | ||
"D. Pareto", | ||
"\u00c0. Rovira", | ||
"V. Callot", | ||
"P. De Sousa", | ||
"A.J.E. Combes", | ||
"C. Law", | ||
"C.Gandini Wheeler-Kingshott", | ||
"H. Benali", | ||
"K.A. Weber II", | ||
"K.P. O'Grady", | ||
"M. Descoteaux", | ||
"M. Dost\u00e1l", | ||
"M. Fratini", | ||
"M. Ke\u0159kovsk\u00fd", | ||
"P. Wyss", | ||
"S.A. Smith", | ||
"F. Grussu", | ||
"M. Battiston", | ||
"M. C. Yiannakas", | ||
"R. S. Samson" | ||
], | ||
"Acknowledgements": "We thank Gerald Moran and Bart Schraa (Siemens Healthcare), Suchandrima Banerjee and Naoyuki Takei (GE Healthcare), Carollyn Hurst, Andr\u00e9 Cyr, Arnaud Bor\u00e9 and Pierre Bellec (Functional Neuroimaging Unit), Charles Tremblay (Polytechnique Montreal), Antonys Melek and Habib Benali (PERFORM center, Concordia University), Ives Levesque (McGill University) and all the volunteers who participated in the Spinal Cord MRI Public Database.", | ||
"Funding": [ | ||
"Funded by the Canada Research Chair in Quantitative Magnetic Resonance Imaging [950-230815]", | ||
"the Canadian Institute of Health Research [CIHR FDN-143263]", | ||
"the Canada Foundation for Innovation [32454, 34824]", | ||
"the Fonds de Recherche du Qu\u00e9bec - Sant\u00e9 [28826]", | ||
"the Fonds de Recherche du Qu\u00e9bec - Nature et Technologies [2015-PR-182754]", | ||
"the Natural Sciences and Engineering Research Council of Canada [435897-2013]", | ||
"the Canada First Research Excellence Fund (IVADO and TransMedTech)", | ||
"the Quebec BioImaging Network [5886]", | ||
"Spinal Research and Wings for Life (INSPIRED project)", | ||
"the National Institutes of Health (NIH) through grant R00EB016689 (R.L.B.)", | ||
"the Instituto Investigaci\u00f3n Carlos III (Spain, PI18/00823). The content is solely the responsibility of the authors and does not necessarily represent the official views of the NIH." | ||
], | ||
"DatasetDOI": "10.18112/openneuro.ds002902.v1.0.0" | ||
} |
72 changes: 72 additions & 0 deletions
72
derivatives/data_preprocessed/sub-amu01/anat/sub-amu01_flip-1_mt-on_space-other_MTS.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"Modality": "MR", | ||
"MagneticFieldStrength": 3, | ||
"Manufacturer": "Siemens", | ||
"ManufacturersModelName": "Verio", | ||
"InstitutionName": "CEMEREM", | ||
"InstitutionalDepartmentName": "CEMEREM", | ||
"InstitutionAddress": "RUE_ST_PIERRE_264_MARSEILLE...92C536..._District_FR_13006", | ||
"DeviceSerialNumber": "40146", | ||
"StationName": "MRC40146", | ||
"PatientPosition": "HFS", | ||
"ProcedureStepDescription": "TEST_VC_SPINE", | ||
"SoftwareVersions": "syngo_MR_B17", | ||
"MRAcquisitionType": "3D", | ||
"SeriesDescription": "GRE-MT1", | ||
"ProtocolName": "GRE-MT1", | ||
"ScanningSequence": "GR", | ||
"SequenceVariant": "MTC_SP", | ||
"ScanOptions": "MT", | ||
"SequenceName": "_fl3d1", | ||
"ImageType": [ | ||
"ORIGINAL", | ||
"PRIMARY", | ||
"M", | ||
"DIS2D" | ||
], | ||
"SeriesNumber": 13, | ||
"AcquisitionTime": "12:09:20.497500", | ||
"AcquisitionNumber": 1, | ||
"SliceThickness": 5, | ||
"SAR": 0.543298, | ||
"EchoTime": 0.0035, | ||
"RepetitionTime": 0.035, | ||
"FlipAngle": 9, | ||
"PartialFourier": 1, | ||
"BaseResolution": 256, | ||
"ShimSetting": [ | ||
-5818, | ||
12738, | ||
-11958, | ||
-438, | ||
-319, | ||
1383, | ||
480, | ||
-194 | ||
], | ||
"TxRefAmp": 351.351, | ||
"PhaseResolution": 1, | ||
"ReceiveCoilName": "NeckMatrix", | ||
"PulseSequenceDetails": "%SiemensSeq%_gre", | ||
"PercentPhaseFOV": 100, | ||
"PhaseEncodingSteps": 255, | ||
"AcquisitionMatrixPE": 256, | ||
"ReconMatrixPE": 256, | ||
"ParallelReductionFactorInPlane": 2, | ||
"PixelBandwidth": 260, | ||
"DwellTime": 7.5e-06, | ||
"ImageOrientationPatientDICOM": [ | ||
1, | ||
0, | ||
0, | ||
0, | ||
0.99889, | ||
-0.0471065 | ||
], | ||
"InPlanePhaseEncodingDirectionDICOM": "COL", | ||
"ConversionSoftware": "dcm2niix", | ||
"ConversionSoftwareVersion": "v1.0.20171215 (OpenJPEG build) Clang8.1.0", | ||
"SpatialReference": { | ||
"Reorientation": "RPI" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
derivatives/data_preprocessed/sub-amu01/anat/sub-amu01_flip-1_mt-on_space-other_MTS.nii.gz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/annex/objects/SHA256E-s1174002--9aa6ec79a78cdfa40d54e8ff8ac2d55629d5c5023c0f918e3fb626ce74ea3c3d.nii.gz |
71 changes: 71 additions & 0 deletions
71
derivatives/data_preprocessed/sub-amu01/anat/sub-amu01_flip-2_mt-off_space-other_MTS.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"Modality": "MR", | ||
"MagneticFieldStrength": 3, | ||
"Manufacturer": "Siemens", | ||
"ManufacturersModelName": "Verio", | ||
"InstitutionName": "CEMEREM", | ||
"InstitutionalDepartmentName": "CEMEREM", | ||
"InstitutionAddress": "RUE_ST_PIERRE_264_MARSEILLE...92C536..._District_FR_13006", | ||
"DeviceSerialNumber": "40146", | ||
"StationName": "MRC40146", | ||
"PatientPosition": "HFS", | ||
"ProcedureStepDescription": "TEST_VC_SPINE", | ||
"SoftwareVersions": "syngo_MR_B17", | ||
"MRAcquisitionType": "3D", | ||
"SeriesDescription": "GRE-T1w", | ||
"ProtocolName": "GRE-T1w", | ||
"ScanningSequence": "GR", | ||
"SequenceVariant": "SP", | ||
"SequenceName": "_fl3d1", | ||
"ImageType": [ | ||
"ORIGINAL", | ||
"PRIMARY", | ||
"M", | ||
"DIS2D" | ||
], | ||
"SeriesNumber": 15, | ||
"AcquisitionTime": "12:13:48.242500", | ||
"AcquisitionNumber": 1, | ||
"SliceThickness": 5, | ||
"SAR": 0.0352258, | ||
"EchoTime": 0.0035, | ||
"RepetitionTime": 0.015, | ||
"FlipAngle": 15, | ||
"PartialFourier": 1, | ||
"BaseResolution": 256, | ||
"ShimSetting": [ | ||
-5818, | ||
12738, | ||
-11958, | ||
-438, | ||
-319, | ||
1383, | ||
480, | ||
-194 | ||
], | ||
"TxRefAmp": 351.351, | ||
"PhaseResolution": 1, | ||
"ReceiveCoilName": "NeckMatrix", | ||
"PulseSequenceDetails": "%SiemensSeq%_gre", | ||
"PercentPhaseFOV": 100, | ||
"PhaseEncodingSteps": 255, | ||
"AcquisitionMatrixPE": 256, | ||
"ReconMatrixPE": 256, | ||
"ParallelReductionFactorInPlane": 2, | ||
"PixelBandwidth": 260, | ||
"DwellTime": 7.5e-06, | ||
"ImageOrientationPatientDICOM": [ | ||
1, | ||
0, | ||
0, | ||
0, | ||
0.99889, | ||
-0.0471065 | ||
], | ||
"InPlanePhaseEncodingDirectionDICOM": "COL", | ||
"ConversionSoftware": "dcm2niix", | ||
"ConversionSoftwareVersion": "v1.0.20171215 (OpenJPEG build) Clang8.1.0", | ||
"SpatialReference": { | ||
"Reorientation": "RPI" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
derivatives/data_preprocessed/sub-amu01/anat/sub-amu01_flip-2_mt-off_space-other_MTS.nii.gz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/annex/objects/SHA256E-s1229554--48c6bd34de552527ad6bc57d911585113a995f1edb07d33d0d5ec0dd77736e5c.nii.gz |
Oops, something went wrong.