Skip to content
Snippets Groups Projects
Commit 8a81bb52 authored by Erik Diers's avatar Erik Diers
Browse files

Testing and Bugfixing

parent 6d1d2a5e
Branches
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
### Purpose
This application will create _SFB_-conform meta data (_meta.json_ files) for all participants in the _participants.tsv_ file of you your study. The _meta.json files_ will include the subjects _ID_, _sex_ and _age_. Moreover it is possible to register a template _meta.json_ file, which values will be adopted into the newly created meta-files.
This application will create _SFB_-conform meta data (_meta.json_ files) for all participants in the _participants.tsv_ file of you your study. The _meta.json files_ will include the subjects _ID_, _sex_, _age_ and _record-date_. Moreover it is possible to register a template _meta.json_ file, which values will be adopted into the newly created meta-files.
### Requirements
It is required to have a Java version greater or equal to 1.8.0 installed. You can download the current Java Corretto here: https://docs.aws.amazon.com/de_de/corretto/latest/corretto-11-ug/downloads-list.html
......@@ -11,6 +11,7 @@ The _participants.tsv_ has to follow the this [standard](https://bids-specificat
- `participant_id`: The exact name of the subject folder. Usually this is composed of two parts: "sub-" and the _SFB code_. The _SFB code_ will be extracted and used as _Subject ID_. The _SFB code_ cannot contain hyphens.
- `sex`: Sex of the subject (_m\[ale] or f\[emale])_.
- `age`: Age of the subject (in years).
- if one also wants to transfer the record date to the meta.json files. Then this information has to be included in the participants.tsv file. For each existing session a column should appear. The naming scheme of the columns must be consistent. The SFB suggests the following pattern: `day-1`, `day-2`, ..., `day-n`
### GUI Usage
Input fields top down:
......@@ -21,7 +22,13 @@ Input fields top down:
If not used, meta-files will be empty besides subject-_ID_, _sex_, _age_ and the name of the Study.
1. _meta.json - File selector:_
Select the template _meta.json_ file.
3. _Convert:_
3. _Include record date from participants.tsv_
If checked then the application tries to transfer the record date from the participants.tsv to the corresponding meta.json file. This only works when:
- the session prefix is defined. This is done with the first input field. This prefix should be "ses-" but may vary if the session are named differently.
- the participants.tsv coloumn name prefix is defined. This is done with the second input field. This is the prefix of column names in the participants.tsv file. This is optimally `day-`.
- the date is in format YYYY-mm-dd[T HH:MM]
4. _Convert:_
Starts _meta.json_ creation process. Once finished, a pop-up message will inform the user. If subjects defined in the _participants.tsv_ are non existing, a warning message will be displayed.
**Please keep in mind that this application overwrites any already created _meta.json_ files in the subjects modality folders**
......
No preview for this file type
......@@ -73,7 +73,7 @@ public class Main {
SimpleFrame.promt("Please select a valid Session Prefix");
return;
}
tsvPrefix = sessionPrefixPanel.getOutput();
tsvPrefix = pTsvPrefixPanel.getOutput();
if (tsvPrefix.equals("")) {
SimpleFrame.promt("Please select a valid Participants TSV RecordDate Column Prefix");
return;
......@@ -105,7 +105,7 @@ public class Main {
final int maxRows = pTsv.getMaxRows();
if (useRecordDate) {
int sesAmount = pTsv.getColumnByPrefixAmount(sessionTSVPrefix);
int sesAmount = pTsv.getColumnByPrefixAmount(sessionTSVPrefix); // This might produce more sessions than exits, but this is normally no drama
sessionsIndexesInTSV = new int[sesAmount];
for(int i = 0; i < sesAmount; i++) {
sessionsIndexesInTSV[i] = pTsv.getColumnByPrefix(sessionTSVPrefix + (i + 1));
......@@ -186,12 +186,12 @@ public class Main {
}
}
System.out.println("Subj Sex: " + sex);
final String DEFAULT_RECORD_DATE = "1970-1-1";
String recordDate = DEFAULT_RECORD_DATE;
if (sessionsIndexesInTSV != null) {
int session = SFB_Util.extractIntegerFromString(metaJSON.getAbsolutePath(), metaJSON.getAbsolutePath().indexOf(sessionFolderPrefix));
int session = SFB_Util.extractIntegerFromString(metaJSON.getAbsolutePath(), metaJSON.getAbsolutePath().indexOf(sessionFolderPrefix) + sessionFolderPrefix.length());
if (session != Integer.MIN_VALUE) {
String pTsvDate = pTsv.get(sessionsIndexesInTSV[session - 1], row);
int clockIndex = pTsvDate.indexOf('T');
......@@ -199,6 +199,7 @@ public class Main {
pTsvDate = pTsvDate.substring(0, clockIndex);
}
recordDate = pTsvDate;
System.out.println("Session: " + session + " Data: " + recordDate);
}
}
......@@ -218,8 +219,10 @@ public class Main {
obj.put("Subject age", age);
obj.put("Subject ID", subjID);
if(!recordDateCpy.equals(DEFAULT_RECORD_DATE))
if(!recordDateCpy.equals(DEFAULT_RECORD_DATE)) {
SFB_JSON_Util.setRecordDate(recordDateCpy, obj);
System.out.println("Data: " + recordDateCpy);
}
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment