Changed stats file output to be pre-java8 compliant.
authormccreedy@NIH.GOV <mccreedy@NIH.GOV@ba61647d-9d00-f842-95cd-605cb4296b96>
Thu, 15 Feb 2018 19:59:26 +0000 (19:59 +0000)
committermccreedy@NIH.GOV <mccreedy@NIH.GOV@ba61647d-9d00-f842-95cd-605cb4296b96>
Thu, 15 Feb 2018 19:59:26 +0000 (19:59 +0000)
git-svn-id: https://citdcbmipav.cit.nih.gov/repos-pub/mipav/trunk@15376 ba61647d-9d00-f842-95cd-605cb4296b96

mipav/src/plugins/PlugInAlgorithmStrokeSegmentation.java

index 99c74c2..dabf9c1 100644 (file)
@@ -82,7 +82,13 @@ public class PlugInAlgorithmStrokeSegmentation extends AlgorithmBase {
         fileInfo1 = dwiSegArray[0].getFileInfo()[0];\r
         fileInfo1.setResolutions(dwiImage.getResolutions(0));\r
         fileInfo1.setUnitsOfMeasure(dwiImage.getUnitsOfMeasure());\r
-        dwiSegArray[0].setFileInfo(fileInfo1, 0);\r
+        fileInfo1.setAxisOrientation(dwiImage.getFileInfo(0).getAxisOrientation());\r
+        fileInfo1.setImageOrientation(dwiImage.getFileInfo(0).getImageOrientation());\r
+        fileInfo1.setOrigin(dwiImage.getFileInfo(0).getOrigin());\r
+        fileInfo1.setSliceThickness(dwiImage.getFileInfo(0).getSliceThickness());\r
+        for (int i = 0; i < dwiImage.getExtents()[2]; i++) {\r
+            dwiSegArray[0].setFileInfo(fileInfo1, i);\r
+        }\r
 \r
         AlgorithmFuzzyCMeans fcmAlgo = new AlgorithmFuzzyCMeans(dwiSegArray, dwiImage, nClasses, nPyramid, oneJacobiIter, twoJacobiIter, q, oneSmooth,\r
                                            twoSmooth, outputGainField, segmentation, cropBackground, threshold, maxIter,\r
@@ -509,11 +515,13 @@ public class PlugInAlgorithmStrokeSegmentation extends AlgorithmBase {
         final String volUnitsStr = adcImage.getFileInfo(0).getVolumeUnitsOfMeasureStr();\r
         \r
         CSVPrinter csvPrinter = null;\r
-        BufferedWriter writer = null;\r
+        BufferedWriter bw = null;\r
+        FileWriter fw = null;\r
         try {\r
-            writer = Files.newBufferedWriter(Paths.get(statsFile));\r
+            fw = new FileWriter(statsFile);\r
+            bw = new BufferedWriter(fw);\r
             \r
-            csvPrinter = new CSVPrinter(writer, CSVFormat.TDF.withHeader("Base Dir", "DWI File", "ADC File", "Core VOI", "Core Voxel Count", "Core Volume " + volUnitsStr));\r
+            csvPrinter = new CSVPrinter(bw, CSVFormat.TDF.withHeader("Base Dir", "DWI File", "ADC File", "Core VOI", "Core Voxel Count", "Core Volume " + volUnitsStr));\r
             csvPrinter.printRecord(outputDir, dwiFile, adcFile, voiFile, numVoxels, coreVol);\r
         } catch (final IOException e) {\r
             e.printStackTrace();\r
@@ -525,8 +533,11 @@ public class PlugInAlgorithmStrokeSegmentation extends AlgorithmBase {
                     csvPrinter.flush();\r
                     csvPrinter.close();\r
                 }\r
-                if (writer != null) {\r
-                    writer.close();\r
+                if (bw != null) {\r
+                    bw.close();\r
+                }\r
+                if (fw != null) {\r
+                    fw.close();\r
                 }\r
             } catch (final IOException e) {\r
                 // do nothing\r