Skip to content

Commit bea5fd1

Browse files
Fix a few anatomical orientation issues after further testing
1 parent ae73818 commit bea5fd1

3 files changed

Lines changed: 20 additions & 16 deletions

File tree

components/formats-bsd/src/loci/formats/in/FakeReader.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ public FakeReader() {
328328
@Override
329329
public Orientation[] getAxisOrientations() {
330330
FormatTools.assertId(currentId, true, 1);
331+
if (orientations.size() == 0) {
332+
return new Orientation[5];
333+
}
331334
return orientations.toArray(new Orientation[orientations.size()]);
332335
}
333336

components/formats-gpl/src/loci/formats/in/AnalyzeReader.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -287,39 +287,40 @@ protected void initFile(String id) throws FormatException, IOException {
287287
// further reference:
288288
// http://www.grahamwideman.com/gw/brain/analyze/formatdoc.htm
289289
// https://eeg.sourceforge.net/mri_orientation_notes.html
290+
String orientationDescription = String.valueOf(orient);
290291
switch (orient) {
291-
case '0':
292-
// transverse unflipped
292+
case 0:
293+
orientationDescription = "transverse unflipped";
293294
xAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.RIGHT_TO_LEFT);
294295
yAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.POSTERIOR_TO_ANTERIOR);
295296
zAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.INFERIOR_TO_SUPERIOR);
296297
break;
297-
case '1':
298-
// coronal unflipped
298+
case 1:
299+
orientationDescription = "coronal unflipped";
299300
xAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.RIGHT_TO_LEFT);
300301
yAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.INFERIOR_TO_SUPERIOR);
301302
zAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.POSTERIOR_TO_ANTERIOR);
302303
break;
303-
case '2':
304-
// sagittal unflipped
304+
case 2:
305+
orientationDescription = "sagittal unflipped";
305306
xAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.POSTERIOR_TO_ANTERIOR);
306307
yAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.INFERIOR_TO_SUPERIOR);
307308
zAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.RIGHT_TO_LEFT);
308309
break;
309-
case '3':
310-
// transverse flipped
310+
case 3:
311+
orientationDescription = "transverse flipped";
311312
xAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.RIGHT_TO_LEFT);
312313
yAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.ANTERIOR_TO_POSTERIOR);
313314
zAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.INFERIOR_TO_SUPERIOR);
314315
break;
315-
case '4':
316-
// coronal flipped
316+
case 4:
317+
orientationDescription = "coronal flipped";
317318
xAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.RIGHT_TO_LEFT);
318319
yAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.SUPERIOR_TO_INFERIOR);
319320
zAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.POSTERIOR_TO_ANTERIOR);
320321
break;
321-
case '5':
322-
// sagittal flipped
322+
case 5:
323+
orientationDescription = "sagittal flipped";
323324
xAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.POSTERIOR_TO_ANTERIOR);
324325
yAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.SUPERIOR_TO_INFERIOR);
325326
zAxis = new Orientation(OrientationType.ANATOMICAL, AnatomicalOrientation.RIGHT_TO_LEFT);
@@ -345,7 +346,7 @@ protected void initFile(String id) throws FormatException, IOException {
345346
addGlobalMeta("Pixel minimum", pixelMin);
346347
addGlobalMeta("Description", description);
347348
addGlobalMeta("Auxiliary file", auxFile);
348-
addGlobalMeta("Orientation", orient);
349+
addGlobalMeta("Orientation", orientationDescription);
349350
addGlobalMeta("Originator", originator);
350351
addGlobalMeta("Generated", generated);
351352
addGlobalMeta("Scan Number", scannum);

components/formats-gpl/src/loci/formats/in/BrukerReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,10 @@ else if (key.equals("##$SUBJECT_type")) {
497497
subjectType = value;
498498
}
499499
else if (key.equals("##$SUBJECT_entry")) {
500-
subjectEntry = value.substring(value.indexOf("_") + 1);
500+
subjectEntry = value.substring(value.lastIndexOf("_") + 1);
501501
}
502-
else if (key.equals("##$SUBJECT_pose")) {
503-
subjectPose = value.substring(value.indexOf("_") + 1);
502+
else if (key.equals("##$SUBJECT_position")) {
503+
subjectPose = value.substring(value.lastIndexOf("_") + 1);
504504
}
505505

506506
if (ms != null) {

0 commit comments

Comments
 (0)