-
Notifications
You must be signed in to change notification settings - Fork 1
/
alohaFindT1T2.jq
45 lines (42 loc) · 1.83 KB
/
alohaFindT1T2.jq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#
# Finds the T1/T2 acquisition from an session.json file
# fwget -1 -ra 66e4737ead8f9c0ea1ce2750 | jq -r --argjson AlohaArgFlag '"-b"' --argjson AlohaArgFlagName '"BaselineT1NiftiTrimmed"' --argjson ClassificationMeasurement '"T1"' -f alohaFindT1T2.jq
# 66e4737ead8f9c0ea1ce2750 is a session id
#
include "alohaLib";
alohaFlagName2FlagArg($AlohaArgFlagName) as $AlohaArgFlag
| .created as $SessionCreated
| select((.acquisitions | length) > 0)
| [
.acquisitions[]
| .label as $AcquisitionLabel
| ._id as $AcquisitionId
| .timestamp as $AcquisitionTimestamp
| select((.files | length) > 0)
| .files[]
| select(
# Leaving out type selection as it is too hard to allow multiples
(.modality == "MR")
and ((.classification.Intent | length) > 0)
and (.classification.Intent | any("Structural"))
and ((.classification.Measurement | length) > 0)
and (.classification.Measurement | any(. == $ClassificationMeasurement))
and ((.tags | length) > 0)
and (.tags | any(. == "AlohaInput"))
)
| {
"FileName": .name
, "FileId": .file_id
, "FileType": .type
, "FileTags": (.tags | sort )
, "FileModality": .modality
, "FileClassification": (.classification.Measurement|join(":"))
, "FileTimestamp": .created
, "AcquisitionLabel": $AcquisitionLabel
, "AcquisitionId": $AcquisitionId
, "AcquistionTimestamp": $AcquisitionTimestamp
, "AlohaArgFlag": $AlohaArgFlag
, "AlohaArgFlagName": $AlohaArgFlagName
}
]
| sort_by(.FileCreated, .FileType, .FileTags)[]