Added automatic name matching of the landmark registration points for the thin-plate...
authorabokinsky <abokinsky@ba61647d-9d00-f842-95cd-605cb4296b96>
Wed, 4 Apr 2018 16:16:54 +0000 (16:16 +0000)
committerabokinsky <abokinsky@ba61647d-9d00-f842-95cd-605cb4296b96>
Wed, 4 Apr 2018 16:16:54 +0000 (16:16 +0000)
git-svn-id: https://citdcbmipav.cit.nih.gov/repos-pub/mipav/trunk@15440 ba61647d-9d00-f842-95cd-605cb4296b96

mipav/src/plugins/PlugInDialogUntwistedToTwisted.java

index d5c6228..ba79687 100644 (file)
@@ -76,20 +76,20 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
         * \r
         */\r
        private static final long serialVersionUID = -5858343401705223389L;\r
-//     private JRadioButton untwistedToTwisted;\r
-//     private JRadioButton twistedToUntwisted;\r
-//     private JRadioButton noseCentric;\r
-//     private JRadioButton defaultCoords;\r
-//     private ModelImage wormImage;\r
-\r
-//     private String baseFileDir;\r
-//     private JTextField  baseFileLocText;\r
-//     private String baseFileName;\r
+       //      private JRadioButton untwistedToTwisted;\r
+       //      private JRadioButton twistedToUntwisted;\r
+       //      private JRadioButton noseCentric;\r
+       //      private JRadioButton defaultCoords;\r
+       //      private ModelImage wormImage;\r
+\r
+       //      private String baseFileDir;\r
+       //      private JTextField  baseFileLocText;\r
+       //      private String baseFileName;\r
        private JTextField straightenedAnnotationText;\r
        private String straightenedAnnotationFile;\r
        private JTextField targetLocText;\r
        private String targetDir;\r
-       \r
+\r
 \r
        private JTextField targetPointsText;\r
        private String targetPointsFile;\r
@@ -99,10 +99,10 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
        private String targetImageName;\r
        private JTextField inputImageText;\r
        private String inputImageName;\r
-//     private JTextField  baseFileNameText;\r
-//     private Vector<Integer> includeRange;\r
-//     private JPanel inputsPanel;\r
-//     private JTextField rangeFusionText;\r
+       //      private JTextField  baseFileNameText;\r
+       //      private Vector<Integer> includeRange;\r
+       //      private JPanel inputsPanel;\r
+       //      private JTextField rangeFusionText;\r
 \r
        public PlugInDialogUntwistedToTwisted()\r
        {\r
@@ -118,17 +118,17 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
         */\r
        public void actionPerformed(ActionEvent event)\r
        {\r
-//             if ( event.getSource() == twistedToUntwisted && twistedToUntwisted.isSelected() )\r
-//             {\r
-//                     defaultCoords.setSelected(true);\r
-//                     noseCentric.setSelected(false);\r
-//                     noseCentric.setEnabled(false);\r
-//             }\r
-//             if ( event.getSource() == untwistedToTwisted && untwistedToTwisted.isSelected() )\r
-//             {\r
-//                     noseCentric.setEnabled(true);\r
-//             }\r
-               \r
+               //              if ( event.getSource() == twistedToUntwisted && twistedToUntwisted.isSelected() )\r
+               //              {\r
+               //                      defaultCoords.setSelected(true);\r
+               //                      noseCentric.setSelected(false);\r
+               //                      noseCentric.setEnabled(false);\r
+               //              }\r
+               //              if ( event.getSource() == untwistedToTwisted && untwistedToTwisted.isSelected() )\r
+               //              {\r
+               //                      noseCentric.setEnabled(true);\r
+               //              }\r
+\r
                String command = event.getActionCommand();\r
                if (command.equals("OK")) {\r
                        if (setVariables()) {\r
@@ -151,11 +151,11 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
        public void dispose()\r
        {\r
                super.dispose();\r
-//             if ( wormImage != null )\r
-//             {\r
-//                     wormImage.disposeLocal();\r
-//                     wormImage = null;\r
-//             }               \r
+               //              if ( wormImage != null )\r
+               //              {\r
+               //                      wormImage.disposeLocal();\r
+               //                      wormImage = null;\r
+               //              }               \r
        }\r
 \r
        public void saveSegmentationStatistics(final String dir, Vector<String> fileNamesList, Vector<Integer> numSegmented, Vector<Integer> numMatched )\r
@@ -239,7 +239,7 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
        {\r
                System.err.println( targetDir );\r
                System.err.println( straightenedAnnotationFile );\r
-               \r
+\r
                if ( (targetDir.length() == 0) || (straightenedAnnotationFile.length() == 0) ) {\r
                        return;\r
                }\r
@@ -250,7 +250,7 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
                String inputFileName = straightenedAnnotationFile.substring(straightenedAnnotationFile.lastIndexOf( File.separator ) + 1, straightenedAnnotationFile.lastIndexOf( '.' ));\r
                System.err.println(outputDirName);\r
                System.err.println(inputFileName);\r
-               \r
+\r
                String toTwistedName = targetDir + File.separator + targetDirName + "_results" + File.separator + \r
                                "output_images" + File.separator + targetDirName + "_toTwisted.xml";\r
                File toTwistedFile = new File( toTwistedName );\r
@@ -272,7 +272,7 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
                                        // read registration points and calculate thin-plate spline transform:\r
                                        VOI targetPts = LatticeModel.readAnnotationsCSV(targetPointsFile);\r
                                        VOI inputPts = LatticeModel.readAnnotationsCSV(inputPointsFile);\r
-                                       \r
+\r
                                        Vector<String> commonNames = new Vector<String>();\r
                                        for ( int i = 0; i < targetPts.getCurves().size(); i++ )\r
                                        {\r
@@ -280,7 +280,7 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
                                                for ( int j = 0; j < inputPts.getCurves().size(); j++ )\r
                                                {\r
                                                        String inputName = ((VOIText)inputPts.getCurves().elementAt(j)).getText();\r
-                                                       \r
+\r
                                                        if ( targetName.equals(inputName) )\r
                                                        {\r
                                                                commonNames.add(inputName);\r
@@ -288,119 +288,122 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
                                                        }\r
                                                }\r
                                        }\r
-                                       \r
-                                       \r
+\r
+\r
                                        int numTargetPts = commonNames.size();\r
-                                       if ( numTargetPts <= 0 ) {\r
-                                               MipavUtil.displayError( "Target points and input points must match" );\r
-                                               return;\r
-                                       }\r
-                                       double[] xSource = new double[ numTargetPts ]; \r
-                                       double[] ySource = new double[ numTargetPts ]; \r
-                                       double[] zSource = new double[ numTargetPts ]; \r
-                                       double[] xTarget = new double[ numTargetPts ]; \r
-                                       double[] yTarget = new double[ numTargetPts ]; \r
-                                       double[] zTarget = new double[ numTargetPts ]; \r
-                                       for ( int i = 0; i < commonNames.size(); i++ ) {\r
-                                               Vector3f sourcePt = null;\r
-                                               Vector3f targetPt = null;\r
-                                               for ( int j = 0; j < targetPts.getCurves().size(); j++ )\r
-                                               {\r
-                                                       String targetName = ((VOIText)targetPts.getCurves().elementAt(j)).getText();\r
-                                                       if ( targetName.equals(commonNames.elementAt(i) ) )\r
+                                       if ( numTargetPts >= 4 ) \r
+                                       {\r
+                                               double[] xSource = new double[ numTargetPts ]; \r
+                                               double[] ySource = new double[ numTargetPts ]; \r
+                                               double[] zSource = new double[ numTargetPts ]; \r
+                                               double[] xTarget = new double[ numTargetPts ]; \r
+                                               double[] yTarget = new double[ numTargetPts ]; \r
+                                               double[] zTarget = new double[ numTargetPts ]; \r
+                                               for ( int i = 0; i < commonNames.size(); i++ ) {\r
+                                                       Vector3f sourcePt = null;\r
+                                                       Vector3f targetPt = null;\r
+                                                       for ( int j = 0; j < targetPts.getCurves().size(); j++ )\r
                                                        {\r
-                                                               targetPt = targetPts.getCurves().elementAt(j).elementAt(0);\r
-                                                               break;\r
+                                                               String targetName = ((VOIText)targetPts.getCurves().elementAt(j)).getText();\r
+                                                               if ( targetName.equals(commonNames.elementAt(i) ) )\r
+                                                               {\r
+                                                                       targetPt = targetPts.getCurves().elementAt(j).elementAt(0);\r
+                                                                       break;\r
+                                                               }\r
+                                                       }\r
+                                                       for ( int j = 0; j < inputPts.getCurves().size(); j++ )\r
+                                                       {\r
+                                                               String inputName = ((VOIText)inputPts.getCurves().elementAt(j)).getText();\r
+                                                               if ( inputName.equals(commonNames.elementAt(i) ) )\r
+                                                               {\r
+                                                                       sourcePt = inputPts.getCurves().elementAt(j).elementAt(0);\r
+                                                                       break;\r
+                                                               }\r
+                                                       }\r
+                                                       if ( sourcePt != null && targetPt != null )\r
+                                                       {\r
+                                                               System.err.println( commonNames.elementAt(i) );\r
+                                                               xSource[i] = sourcePt.X;                                        ySource[i] = sourcePt.Y;                                        zSource[i] = sourcePt.Z;\r
+                                                               xTarget[i] = targetPt.X;                                        yTarget[i] = targetPt.Y;                                        zTarget[i] = targetPt.Z;\r
                                                        }\r
                                                }\r
-                                               for ( int j = 0; j < inputPts.getCurves().size(); j++ )\r
-                                               {\r
-                                                       String inputName = ((VOIText)inputPts.getCurves().elementAt(j)).getText();\r
-                                                       if ( inputName.equals(commonNames.elementAt(i) ) )\r
+\r
+                                               ModelImage inputImage = null;\r
+                                               if ( inputImageName != null ) {\r
+                                                       File inputImageFile = new File( inputImageName );\r
+                                                       if ( inputImageFile.exists() )\r
                                                        {\r
-                                                               sourcePt = inputPts.getCurves().elementAt(j).elementAt(0);\r
-                                                               break;\r
+                                                               fileIO = new FileIO();\r
+                                                               inputImage = fileIO.readImage(inputImageName);\r
                                                        }\r
                                                }\r
-                                               if ( sourcePt != null && targetPt != null )\r
+                                               boolean writeOutput = true;\r
+                                               if ( inputImage == null )\r
                                                {\r
-                                                       System.err.println( commonNames.elementAt(i) );\r
-                                                       xSource[i] = sourcePt.X;                                        ySource[i] = sourcePt.Y;                                        zSource[i] = sourcePt.Z;\r
-                                                       xTarget[i] = targetPt.X;                                        yTarget[i] = targetPt.Y;                                        zTarget[i] = targetPt.Z;\r
+                                                       // no input image to warp, use the toTwisted image for dimensions, etc.\r
+                                                       inputImage = toTwisted;\r
+                                                       writeOutput = false;\r
                                                }\r
-                                       }\r
-                                       \r
-                                       ModelImage inputImage = null;\r
-                                       if ( inputImageName != null ) {\r
-                                               File inputImageFile = new File( inputImageName );\r
-                                               if ( inputImageFile.exists() )\r
-                                               {\r
-                                                       fileIO = new FileIO();\r
-                                                       inputImage = fileIO.readImage(inputImageName);\r
+                                               ModelImage targetImage = null;\r
+                                               if ( (targetImageName != null) && writeOutput) {\r
+                                                       File inputImageFile = new File( targetImageName );\r
+                                                       if ( inputImageFile.exists() )\r
+                                                       {\r
+                                                               fileIO = new FileIO();\r
+                                                               targetImage = fileIO.readImage(targetImageName);\r
+                                                       }\r
                                                }\r
-                                       }\r
-                                       boolean writeOutput = true;\r
-                                       if ( inputImage == null )\r
-                                       {\r
-                                               // no input image to warp, use the toTwisted image for dimensions, etc.\r
-                                               inputImage = toTwisted;\r
-                                               writeOutput = false;\r
-                                       }\r
-                                       ModelImage targetImage = null;\r
-                                       if ( (targetImageName != null) && writeOutput) {\r
-                                               File inputImageFile = new File( targetImageName );\r
-                                               if ( inputImageFile.exists() )\r
+                                               if ( targetImage == null )\r
                                                {\r
-                                                       fileIO = new FileIO();\r
-                                                       targetImage = fileIO.readImage(targetImageName);\r
+                                                       targetImage = inputImage;\r
                                                }\r
-                                       }\r
-                                       if ( targetImage == null )\r
-                                       {\r
-                                               targetImage = inputImage;\r
-                                       }\r
-                                       spline = new AlgorithmTPSpline(xSource, ySource, zSource, xTarget, yTarget, zTarget, 0.0f, targetImage,\r
-                                                       inputImage, !writeOutput);\r
+                                               spline = new AlgorithmTPSpline(xSource, ySource, zSource, xTarget, yTarget, zTarget, 0.0f, targetImage,\r
+                                                               inputImage, !writeOutput);\r
 \r
-                                       spline.setRunningInSeparateThread(false);\r
-                                       spline.run();\r
-                                       \r
-                                       if ( writeOutput )\r
-                                       {\r
-                                               ModelImage outputImage = spline.getResultImage();\r
-                                               outputImage.calcMinMax();\r
-                                               new ViewJFrameImage((ModelImage) outputImage.clone());\r
-                                               System.err.println( outputImage.getImageName() + "   " + outputImage.getImageDirectory() );\r
-                                               ModelImage.saveImage(outputImage);\r
-                                               outputImage.disposeLocal(false);\r
-                                               outputImage = null;\r
-                                               inputImage.disposeLocal(false);\r
-                                               inputImage = null;\r
-                                               \r
-                                               if ( targetImage != null )\r
+                                               spline.setRunningInSeparateThread(false);\r
+                                               spline.run();\r
+\r
+                                               if ( writeOutput )\r
                                                {\r
-                                                       targetImage.disposeLocal(false);\r
-                                                       targetImage = null;\r
+                                                       ModelImage outputImage = spline.getResultImage();\r
+                                                       outputImage.calcMinMax();\r
+                                                       new ViewJFrameImage((ModelImage) outputImage.clone());\r
+                                                       System.err.println( outputImage.getImageName() + "   " + outputImage.getImageDirectory() );\r
+                                                       ModelImage.saveImage(outputImage);\r
+                                                       outputImage.disposeLocal(false);\r
+                                                       outputImage = null;\r
+                                                       inputImage.disposeLocal(false);\r
+                                                       inputImage = null;\r
+\r
+                                                       if ( targetImage != null )\r
+                                                       {\r
+                                                               targetImage.disposeLocal(false);\r
+                                                               targetImage = null;\r
+                                                       }\r
                                                }\r
-                                       }\r
 \r
-                                       for ( int i = 0; i < numTargetPts; i++ ) {\r
-                                               Vector3f sourcePt = inputPts.getCurves().elementAt(i).elementAt(0);\r
-                                               Vector3f targetPt = targetPts.getCurves().elementAt(i).elementAt(0);\r
-                                               float[] transformedPt = spline.getCorrespondingPoint(sourcePt.X, sourcePt.Y, sourcePt.Z);\r
-                                               if ( (Math.round(targetPt.X) != Math.round(transformedPt[0])) || (Math.round(targetPt.Y) != Math.round(transformedPt[1])) || (Math.round(targetPt.Z) != Math.round(transformedPt[2])) )\r
-                                               {\r
-                                                       System.err.println( sourcePt + "   =>  " + transformedPt[0] + " " + transformedPt[1] + " " + transformedPt[2] );\r
+                                               for ( int i = 0; i < numTargetPts; i++ ) {\r
+                                                       Vector3f sourcePt = inputPts.getCurves().elementAt(i).elementAt(0);\r
+                                                       Vector3f targetPt = targetPts.getCurves().elementAt(i).elementAt(0);\r
+                                                       float[] transformedPt = spline.getCorrespondingPoint(sourcePt.X, sourcePt.Y, sourcePt.Z);\r
+                                                       if ( (Math.round(targetPt.X) != Math.round(transformedPt[0])) || (Math.round(targetPt.Y) != Math.round(transformedPt[1])) || (Math.round(targetPt.Z) != Math.round(transformedPt[2])) )\r
+                                                       {\r
+                                                               System.err.println( sourcePt + "   =>  " + transformedPt[0] + " " + transformedPt[1] + " " + transformedPt[2] );\r
+                                                       }\r
                                                }\r
                                        }\r
+\r
+                                       else {\r
+                                               MipavUtil.displayError( "Target points and input points must have at least 4 matches" );\r
+                                       }\r
                                }\r
-                       \r
-                               \r
+\r
+\r
                                int dimX = toTwisted.getExtents().length > 0 ? toTwisted.getExtents()[0] : 1;\r
                                int dimY = toTwisted.getExtents().length > 1 ? toTwisted.getExtents()[1] : 1;\r
                                int dimZ = toTwisted.getExtents().length > 2 ? toTwisted.getExtents()[2] : 1;\r
-//                             System.err.println("displaying image...");\r
-//                             new ViewJFrameImage(toTwisted);\r
+                               //                              System.err.println("displaying image...");\r
+                               //                              new ViewJFrameImage(toTwisted);\r
                                VOI annotations = LatticeModel.readAnnotationsCSV(straightenedAnnotationFile);\r
                                if ( annotations != null )\r
                                {\r
@@ -423,10 +426,10 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
                                                                transformedPt.Y = temp[1];\r
                                                                transformedPt.Z = temp[2];\r
                                                        }\r
-                                                       \r
+\r
                                                        if ( ((int)transformedPt.X >= 0) && ((int)transformedPt.X < dimX) && \r
-                                                                ((int)transformedPt.Y >= 0) && ((int)transformedPt.Y < dimY) &&\r
-                                                                ((int)transformedPt.Z >= 0) && ((int)transformedPt.Z < dimZ)    )\r
+                                                                       ((int)transformedPt.Y >= 0) && ((int)transformedPt.Y < dimY) &&\r
+                                                                       ((int)transformedPt.Z >= 0) && ((int)transformedPt.Z < dimZ)    )\r
                                                        {\r
                                                                float x = toTwisted.getFloatC( (int)transformedPt.X, (int)transformedPt.Y, (int)transformedPt.Z, 1 );\r
                                                                float y = toTwisted.getFloatC( (int)transformedPt.X, (int)transformedPt.Y, (int)transformedPt.Z, 2 );\r
@@ -474,191 +477,191 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
                {\r
                        MipavUtil.displayError( "Error reading file: " + toTwistedFile.getName() );\r
                }\r
-               \r
-               \r
-//             if ( includeRange != null )\r
-//             {\r
-//                     System.err.println("Starting plugin" );\r
-//                     for ( int i = 0; i < includeRange.size(); i++ )\r
-//                     {                               \r
-//                             // Build the full image name:\r
-//                             baseFileName = baseFileNameText.getText();\r
-//                             String fileName = baseFileName + "_" + includeRange.elementAt(i) + ".tif";\r
-//                             File imageFile = new File(baseFileDir + File.separator + fileName);\r
-//\r
-//                             if ( imageFile.exists() )\r
-//                             {       \r
-//                                     System.err.println( "   " + fileName );\r
-//                                     FileIO fileIO = new FileIO();\r
-//                                     if ( wormImage != null )\r
-//                                     {\r
-//                                             wormImage.disposeLocal(false);\r
-//                                             wormImage = null;\r
-//                                     }\r
-//                                     wormImage = fileIO.readImage(fileName, baseFileDir + File.separator, false, null);  \r
-//                                     WormData wormData = new WormData(wormImage);\r
-//\r
-////                                   String positionsFile = baseFileName + "_" + includeRange.elementAt(i) + "_positions.csv";\r
-////                                   System.err.println( "   " + positionsFile );\r
-////                                   File textFile = new File(baseFileDir + File.separator + "Positions" + File.separator + positionsFile);\r
-////                                   if ( textFile.exists() )\r
-////                                   {                       \r
-////                                           if ( twistedToUntwisted.isSelected() )\r
-////                                           {\r
-////                                                   String latticeFile = baseFileDir + File.separator + baseFileName + "_"  + includeRange.elementAt(i) + File.separator +\r
-////                                                                   baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator +                                                                  \r
-////                                                                   PlugInAlgorithmWormUntwisting.autoLatticeGenerationOutput + "1" + File.separator;\r
-////                                                   VOIVector latticeVector = new VOIVector();\r
-////                                                   PlugInAlgorithmWormUntwisting.loadAllVOIsFrom(wormImage, latticeFile, true, latticeVector, false);\r
-////                                                   if ( latticeVector.size() != 0 )\r
-////                                                   {\r
-////                                                           VOIVector vois = readMarkerPositions(positionsFile, textFile, null);\r
-////                                                           VOI annotations = vois.elementAt(0);\r
-////\r
-////                                                           if ( annotations != null )\r
-////                                                           {\r
-////                                                                   if ( annotations.getCurves().size() > 0 )\r
-////                                                                   {\r
-////                                                                           LatticeModel model = new LatticeModel(wormImage);\r
-////                                                                           model.setSeamCellImage( wormData.readSeamSegmentation() );\r
-////                                                                           model.setLattice(latticeVector.elementAt(0));\r
-////                                                                           model.setMarkers(annotations);\r
-////\r
-////                                                                           model.interpolateLattice( false, false, false, true );  \r
-////\r
-////                                                                           VOI annotationsStraight = model.getAnnotationsStraight();\r
-////\r
-////\r
-////                                                                           String distanceName = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
-////                                                                                           baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + \r
-////                                                                                           "output_images" + File.separator + \r
-////                                                                                           baseFileName + "_" + includeRange.elementAt(i) + "_distanceMap.xml";\r
-////                                                                           File distanceMapFile = new File(baseFileDir + File.separator + distanceName );\r
-//////                                                                         System.err.println(distanceName + " " + distanceMapFile.exists() );                                                                                     \r
-////                                                                           ModelImage distanceMap = null;\r
-////                                                                           if ( distanceMapFile.exists() )\r
-////                                                                           {\r
-////                                                                                   distanceMap = fileIO.readImage(distanceName, baseFileDir + File.separator, false, null);\r
-////                                                                           }\r
-////                                                                           Vector<Integer> distance = null;\r
-////                                                                           if ( distanceMap != null )\r
-////                                                                           {\r
-////                                                                                   distance = new Vector<Integer>();\r
-////                                                                                   for ( int j = 0; j < annotationsStraight.getCurves().size(); j++ )\r
-////                                                                                   {\r
-////                                                                                           VOIText text = (VOIText) annotationsStraight.getCurves().elementAt(j);\r
-////                                                                                           Vector3f pos = text.elementAt(0);\r
-////                                                                                           int d = (distanceMap == null) ? 0 : distanceMap.getInt( (int)pos.X, (int)pos.Y, (int)pos.Z );\r
-////                                                                                           distance.add(d);\r
-////                                                                                   }\r
-////                                                                                   \r
-////                                                                                   distanceMap.disposeLocal(false);\r
-////                                                                                   distanceMap = null;\r
-////                                                                           }\r
-////\r
-////                                                                           String fileBase = baseFileName + "_" + includeRange.elementAt(i) + "_positions_straight.csv";\r
-////                                                                           saveMarkerPositions(baseFileDir + File.separator + "Positions" + File.separator + fileBase, annotationsStraight, distance);\r
-////                                                                           model.dispose();\r
-////                                                                           model = null;\r
-////                                                                   }\r
-////                                                           }\r
-////                                                   }\r
-////                                           }\r
-////                                           else if ( untwistedToTwisted.isSelected() )\r
-////                                           {\r
-//                                                     String toTwistedName = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
-//                                                                     baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + \r
-//                                                                     "output_images" + File.separator + \r
-//                                                                     baseFileName + "_" + includeRange.elementAt(i) + "_toTwisted.xml";\r
-//                                                     File toTwistedFile = new File(baseFileDir + File.separator + toTwistedName );\r
-////                                                   System.err.println(toTwistedName + " " + toTwistedFile.exists() );\r
-//                                                     ModelImage toTwisted = null;\r
-//                                                     if ( toTwistedFile.exists() )\r
-//                                                     {\r
-//                                                             toTwisted = fileIO.readImage(toTwistedName, baseFileDir + File.separator, false, null);  \r
-//                                                     }\r
-//                                                     String distanceName = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
-//                                                                     baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + \r
-//                                                                     "output_images" + File.separator + \r
-//                                                                     baseFileName + "_" + includeRange.elementAt(i) + "_distanceMap.xml";\r
-//                                                     File distanceMapFile = new File(baseFileDir + File.separator + distanceName );\r
-////                                                   System.err.println(distanceName + " " + distanceMapFile.exists() );\r
-//                                                     ModelImage distanceMap = null;\r
-//                                                     if ( distanceMapFile.exists() )\r
-//                                                     {\r
-//                                                             distanceMap = fileIO.readImage(distanceName, baseFileDir + File.separator, false, null);  \r
-//                                                     }\r
-//                                                     if ( toTwisted != null )\r
-//                                                     {\r
-//                                                             String positionsFile = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
-//                                                                             baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + "tracked_annotations" + File.separator + \r
-//                                                                             "tracked_annotations.csv";\r
-//                                                             File textFile = new File(baseFileDir + File.separator + positionsFile);\r
-//                                                                             \r
-//                                                             int[] imageExtents = new int[]{toTwisted.getExtents()[0], toTwisted.getExtents()[1]};\r
-//                                                             VOIVector vois = readMarkerPositions(positionsFile, textFile, imageExtents);\r
-//                                                             VOI annotations = vois.elementAt(0);\r
-//\r
-//                                                             if ( annotations != null )\r
-//                                                             {\r
-//                                                                     if ( annotations.getCurves().size() > 0 )\r
-//                                                                     {\r
-//\r
-//                                                                             VOI annotationVOI = new VOI( (short)0, fileName, VOI.ANNOTATION, 0 );\r
-//                                                                             Vector<Integer> distance = new Vector<Integer>();\r
-//                                                                             for ( int j = 0; j < annotations.getCurves().size(); j++ )\r
-//                                                                             {\r
-//                                                                                     VOIText text = (VOIText) annotations.getCurves().elementAt(j);\r
-//                                                                                     Vector3f pos = text.elementAt(0);\r
-//                                                                                     String name = text.getText();\r
-//\r
-//                                                                                     float valid = toTwisted.getFloatC( (int)pos.X, (int)pos.Y, (int)pos.Z, 0 );\r
-////                                                                                   if ( valid != 1 )\r
-////                                                                                   {\r
-////                                                                                           System.err.println( name + " invalid position" );\r
-////                                                                                   }\r
-//                                                                                     float x = toTwisted.getFloatC( (int)pos.X, (int)pos.Y, (int)pos.Z, 1 );\r
-//                                                                                     float y = toTwisted.getFloatC( (int)pos.X, (int)pos.Y, (int)pos.Z, 2 );\r
-//                                                                                     float z = toTwisted.getFloatC( (int)pos.X, (int)pos.Y, (int)pos.Z, 3 );\r
-//                                                                                     Vector3f newPos = new Vector3f(x, y, z);\r
-//\r
-//                                                                                     VOIText newText = new VOIText();\r
-//                                                                                     newText.setText(name);\r
-//                                                                                     newText.add(newPos);\r
-//\r
-//                                                                                     annotationVOI.getCurves().add(newText);\r
-//\r
-//\r
-//                                                                                     int d = (distanceMap == null) ? 0 : distanceMap.getInt( (int)pos.X, (int)pos.Y, (int)pos.Z );\r
-//                                                                                     distance.add(d);\r
-//                                                                             }\r
-//                                                                             \r
-//                                                                             String outputFile = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
-//                                                                                             baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + "tracked_annotations" + File.separator + \r
-//                                                                                             "tracked_annotations_twisted.csv";\r
-//                                                                             saveMarkerPositions(baseFileDir + File.separator + outputFile, annotationVOI, distance);\r
-//                                                                             \r
-//                                                                             toTwisted.disposeLocal(false);\r
-//                                                                             toTwisted = null;\r
-//                                                                             if ( distanceMap != null )\r
-//                                                                             {\r
-//                                                                                     distanceMap.disposeLocal(false);\r
-//                                                                                     distanceMap = null;\r
-//                                                                             }\r
-//                                                                     }\r
-//                                                             }\r
-//                                                     }\r
-////                                           }\r
-////                                   }\r
-//                             }\r
-//                             else\r
-//                             {\r
-//                                     MipavUtil.displayError( "Error in reading image file " + fileName );\r
-//                             }\r
-//\r
-//                     }\r
-//                     System.err.println("Done plugin" );\r
-//             }\r
+\r
+\r
+               //              if ( includeRange != null )\r
+               //              {\r
+               //                      System.err.println("Starting plugin" );\r
+               //                      for ( int i = 0; i < includeRange.size(); i++ )\r
+               //                      {                               \r
+               //                              // Build the full image name:\r
+               //                              baseFileName = baseFileNameText.getText();\r
+               //                              String fileName = baseFileName + "_" + includeRange.elementAt(i) + ".tif";\r
+               //                              File imageFile = new File(baseFileDir + File.separator + fileName);\r
+               //\r
+               //                              if ( imageFile.exists() )\r
+               //                              {       \r
+               //                                      System.err.println( "   " + fileName );\r
+               //                                      FileIO fileIO = new FileIO();\r
+               //                                      if ( wormImage != null )\r
+               //                                      {\r
+               //                                              wormImage.disposeLocal(false);\r
+               //                                              wormImage = null;\r
+               //                                      }\r
+               //                                      wormImage = fileIO.readImage(fileName, baseFileDir + File.separator, false, null);  \r
+               //                                      WormData wormData = new WormData(wormImage);\r
+               //\r
+               ////                                    String positionsFile = baseFileName + "_" + includeRange.elementAt(i) + "_positions.csv";\r
+               ////                                    System.err.println( "   " + positionsFile );\r
+               ////                                    File textFile = new File(baseFileDir + File.separator + "Positions" + File.separator + positionsFile);\r
+               ////                                    if ( textFile.exists() )\r
+               ////                                    {                       \r
+               ////                                            if ( twistedToUntwisted.isSelected() )\r
+               ////                                            {\r
+               ////                                                    String latticeFile = baseFileDir + File.separator + baseFileName + "_"  + includeRange.elementAt(i) + File.separator +\r
+               ////                                                                    baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator +                                                                  \r
+               ////                                                                    PlugInAlgorithmWormUntwisting.autoLatticeGenerationOutput + "1" + File.separator;\r
+               ////                                                    VOIVector latticeVector = new VOIVector();\r
+               ////                                                    PlugInAlgorithmWormUntwisting.loadAllVOIsFrom(wormImage, latticeFile, true, latticeVector, false);\r
+               ////                                                    if ( latticeVector.size() != 0 )\r
+               ////                                                    {\r
+               ////                                                            VOIVector vois = readMarkerPositions(positionsFile, textFile, null);\r
+               ////                                                            VOI annotations = vois.elementAt(0);\r
+               ////\r
+               ////                                                            if ( annotations != null )\r
+               ////                                                            {\r
+               ////                                                                    if ( annotations.getCurves().size() > 0 )\r
+               ////                                                                    {\r
+               ////                                                                            LatticeModel model = new LatticeModel(wormImage);\r
+               ////                                                                            model.setSeamCellImage( wormData.readSeamSegmentation() );\r
+               ////                                                                            model.setLattice(latticeVector.elementAt(0));\r
+               ////                                                                            model.setMarkers(annotations);\r
+               ////\r
+               ////                                                                            model.interpolateLattice( false, false, false, true );  \r
+               ////\r
+               ////                                                                            VOI annotationsStraight = model.getAnnotationsStraight();\r
+               ////\r
+               ////\r
+               ////                                                                            String distanceName = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
+               ////                                                                                            baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + \r
+               ////                                                                                            "output_images" + File.separator + \r
+               ////                                                                                            baseFileName + "_" + includeRange.elementAt(i) + "_distanceMap.xml";\r
+               ////                                                                            File distanceMapFile = new File(baseFileDir + File.separator + distanceName );\r
+               //////                                                                          System.err.println(distanceName + " " + distanceMapFile.exists() );                                                                                     \r
+               ////                                                                            ModelImage distanceMap = null;\r
+               ////                                                                            if ( distanceMapFile.exists() )\r
+               ////                                                                            {\r
+               ////                                                                                    distanceMap = fileIO.readImage(distanceName, baseFileDir + File.separator, false, null);\r
+               ////                                                                            }\r
+               ////                                                                            Vector<Integer> distance = null;\r
+               ////                                                                            if ( distanceMap != null )\r
+               ////                                                                            {\r
+               ////                                                                                    distance = new Vector<Integer>();\r
+               ////                                                                                    for ( int j = 0; j < annotationsStraight.getCurves().size(); j++ )\r
+               ////                                                                                    {\r
+               ////                                                                                            VOIText text = (VOIText) annotationsStraight.getCurves().elementAt(j);\r
+               ////                                                                                            Vector3f pos = text.elementAt(0);\r
+               ////                                                                                            int d = (distanceMap == null) ? 0 : distanceMap.getInt( (int)pos.X, (int)pos.Y, (int)pos.Z );\r
+               ////                                                                                            distance.add(d);\r
+               ////                                                                                    }\r
+               ////                                                                                    \r
+               ////                                                                                    distanceMap.disposeLocal(false);\r
+               ////                                                                                    distanceMap = null;\r
+               ////                                                                            }\r
+               ////\r
+               ////                                                                            String fileBase = baseFileName + "_" + includeRange.elementAt(i) + "_positions_straight.csv";\r
+               ////                                                                            saveMarkerPositions(baseFileDir + File.separator + "Positions" + File.separator + fileBase, annotationsStraight, distance);\r
+               ////                                                                            model.dispose();\r
+               ////                                                                            model = null;\r
+               ////                                                                    }\r
+               ////                                                            }\r
+               ////                                                    }\r
+               ////                                            }\r
+               ////                                            else if ( untwistedToTwisted.isSelected() )\r
+               ////                                            {\r
+               //                                                      String toTwistedName = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
+               //                                                                      baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + \r
+               //                                                                      "output_images" + File.separator + \r
+               //                                                                      baseFileName + "_" + includeRange.elementAt(i) + "_toTwisted.xml";\r
+               //                                                      File toTwistedFile = new File(baseFileDir + File.separator + toTwistedName );\r
+               ////                                                    System.err.println(toTwistedName + " " + toTwistedFile.exists() );\r
+               //                                                      ModelImage toTwisted = null;\r
+               //                                                      if ( toTwistedFile.exists() )\r
+               //                                                      {\r
+               //                                                              toTwisted = fileIO.readImage(toTwistedName, baseFileDir + File.separator, false, null);  \r
+               //                                                      }\r
+               //                                                      String distanceName = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
+               //                                                                      baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + \r
+               //                                                                      "output_images" + File.separator + \r
+               //                                                                      baseFileName + "_" + includeRange.elementAt(i) + "_distanceMap.xml";\r
+               //                                                      File distanceMapFile = new File(baseFileDir + File.separator + distanceName );\r
+               ////                                                    System.err.println(distanceName + " " + distanceMapFile.exists() );\r
+               //                                                      ModelImage distanceMap = null;\r
+               //                                                      if ( distanceMapFile.exists() )\r
+               //                                                      {\r
+               //                                                              distanceMap = fileIO.readImage(distanceName, baseFileDir + File.separator, false, null);  \r
+               //                                                      }\r
+               //                                                      if ( toTwisted != null )\r
+               //                                                      {\r
+               //                                                              String positionsFile = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
+               //                                                                              baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + "tracked_annotations" + File.separator + \r
+               //                                                                              "tracked_annotations.csv";\r
+               //                                                              File textFile = new File(baseFileDir + File.separator + positionsFile);\r
+               //                                                                              \r
+               //                                                              int[] imageExtents = new int[]{toTwisted.getExtents()[0], toTwisted.getExtents()[1]};\r
+               //                                                              VOIVector vois = readMarkerPositions(positionsFile, textFile, imageExtents);\r
+               //                                                              VOI annotations = vois.elementAt(0);\r
+               //\r
+               //                                                              if ( annotations != null )\r
+               //                                                              {\r
+               //                                                                      if ( annotations.getCurves().size() > 0 )\r
+               //                                                                      {\r
+               //\r
+               //                                                                              VOI annotationVOI = new VOI( (short)0, fileName, VOI.ANNOTATION, 0 );\r
+               //                                                                              Vector<Integer> distance = new Vector<Integer>();\r
+               //                                                                              for ( int j = 0; j < annotations.getCurves().size(); j++ )\r
+               //                                                                              {\r
+               //                                                                                      VOIText text = (VOIText) annotations.getCurves().elementAt(j);\r
+               //                                                                                      Vector3f pos = text.elementAt(0);\r
+               //                                                                                      String name = text.getText();\r
+               //\r
+               //                                                                                      float valid = toTwisted.getFloatC( (int)pos.X, (int)pos.Y, (int)pos.Z, 0 );\r
+               ////                                                                                    if ( valid != 1 )\r
+               ////                                                                                    {\r
+               ////                                                                                            System.err.println( name + " invalid position" );\r
+               ////                                                                                    }\r
+               //                                                                                      float x = toTwisted.getFloatC( (int)pos.X, (int)pos.Y, (int)pos.Z, 1 );\r
+               //                                                                                      float y = toTwisted.getFloatC( (int)pos.X, (int)pos.Y, (int)pos.Z, 2 );\r
+               //                                                                                      float z = toTwisted.getFloatC( (int)pos.X, (int)pos.Y, (int)pos.Z, 3 );\r
+               //                                                                                      Vector3f newPos = new Vector3f(x, y, z);\r
+               //\r
+               //                                                                                      VOIText newText = new VOIText();\r
+               //                                                                                      newText.setText(name);\r
+               //                                                                                      newText.add(newPos);\r
+               //\r
+               //                                                                                      annotationVOI.getCurves().add(newText);\r
+               //\r
+               //\r
+               //                                                                                      int d = (distanceMap == null) ? 0 : distanceMap.getInt( (int)pos.X, (int)pos.Y, (int)pos.Z );\r
+               //                                                                                      distance.add(d);\r
+               //                                                                              }\r
+               //                                                                              \r
+               //                                                                              String outputFile = baseFileName + "_" + includeRange.elementAt(i) + File.separator + \r
+               //                                                                                              baseFileName + "_" + includeRange.elementAt(i) + "_results" + File.separator + "tracked_annotations" + File.separator + \r
+               //                                                                                              "tracked_annotations_twisted.csv";\r
+               //                                                                              saveMarkerPositions(baseFileDir + File.separator + outputFile, annotationVOI, distance);\r
+               //                                                                              \r
+               //                                                                              toTwisted.disposeLocal(false);\r
+               //                                                                              toTwisted = null;\r
+               //                                                                              if ( distanceMap != null )\r
+               //                                                                              {\r
+               //                                                                                      distanceMap.disposeLocal(false);\r
+               //                                                                                      distanceMap = null;\r
+               //                                                                              }\r
+               //                                                                      }\r
+               //                                                              }\r
+               //                                                      }\r
+               ////                                            }\r
+               ////                                    }\r
+               //                              }\r
+               //                              else\r
+               //                              {\r
+               //                                      MipavUtil.displayError( "Error in reading image file " + fileName );\r
+               //                              }\r
+               //\r
+               //                      }\r
+               //                      System.err.println("Done plugin" );\r
+               //              }\r
        }     \r
 \r
 \r
@@ -697,13 +700,13 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
                JPanel inputsPanel = new JPanel(new GridBagLayout());\r
                inputsPanel.setBorder(JDialogBase.buildTitledBorder("Input - Untwisted Space"));\r
                inputsPanel.setForeground(Color.black);\r
-               \r
+\r
                straightenedAnnotationText = gui.buildFileField("Annotations to retwist (csv): ", "", false, JFileChooser.FILES_ONLY, this);\r
                inputsPanel.add(straightenedAnnotationText.getParent(), gbc);\r
                gbc.gridy++;\r
 \r
 \r
-               \r
+\r
                JPanel regPanel = new JPanel(new GridBagLayout());\r
                regPanel.setBorder(JDialogBase.buildTitledBorder("Registration (optional) - Untwisted Space"));\r
                regPanel.setForeground(Color.black);\r
@@ -729,47 +732,47 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
                JPanel dirPanel = new JPanel(new GridBagLayout());\r
                dirPanel.setBorder(JDialogBase.buildTitledBorder("Directory Information"));\r
                dirPanel.setForeground(Color.black);\r
-               \r
+\r
                targetLocText = gui.buildFileField("Target directory: ", "", false, JFileChooser.DIRECTORIES_ONLY, this);\r
                dirPanel.add(targetLocText.getParent(), gbc);\r
                gbc.gridy++;\r
 \r
-//             baseFileNameText = gui.buildField("Base images name: ", "Decon");\r
-//             inputsPanel.add(baseFileNameText.getParent(), gbc);\r
-//             gbc.gridy++;\r
-//\r
-//             rangeFusionText = gui.buildField("Range of images to segment (ex. 3-7, 12, 18-21, etc.): ", "             ");\r
-//             inputsPanel.add(rangeFusionText.getParent(), gbc);\r
-//             gbc.gridy++;\r
-\r
-//             ButtonGroup group = new ButtonGroup();\r
-//             untwistedToTwisted = gui.buildRadioButton( "untwisted->twisted", true);\r
-//             untwistedToTwisted.addActionListener(this);\r
-//             inputsPanel.add(untwistedToTwisted.getParent(), gbc);\r
-//             group.add(untwistedToTwisted);\r
-//             gbc.gridy++;\r
-//             twistedToUntwisted = gui.buildRadioButton( "twisted->untwisted", false);\r
-//             twistedToUntwisted.addActionListener(this);\r
-//             inputsPanel.add(twistedToUntwisted.getParent(), gbc);\r
-//             group.add(twistedToUntwisted);\r
-//\r
-//\r
-//             gbc.gridy++;\r
-//             group = new ButtonGroup();\r
-//             defaultCoords = gui.buildRadioButton("default coordinates", true);\r
-//             inputsPanel.add(defaultCoords.getParent(), gbc);\r
-//             group.add(defaultCoords);\r
-//             gbc.gridy++;\r
-//             noseCentric = gui.buildRadioButton("nose centered", false);\r
-//             inputsPanel.add(noseCentric.getParent(), gbc);\r
-//             group.add(noseCentric);\r
-//             gbc.gridy++;\r
+               //              baseFileNameText = gui.buildField("Base images name: ", "Decon");\r
+               //              inputsPanel.add(baseFileNameText.getParent(), gbc);\r
+               //              gbc.gridy++;\r
+               //\r
+               //              rangeFusionText = gui.buildField("Range of images to segment (ex. 3-7, 12, 18-21, etc.): ", "             ");\r
+               //              inputsPanel.add(rangeFusionText.getParent(), gbc);\r
+               //              gbc.gridy++;\r
+\r
+               //              ButtonGroup group = new ButtonGroup();\r
+               //              untwistedToTwisted = gui.buildRadioButton( "untwisted->twisted", true);\r
+               //              untwistedToTwisted.addActionListener(this);\r
+               //              inputsPanel.add(untwistedToTwisted.getParent(), gbc);\r
+               //              group.add(untwistedToTwisted);\r
+               //              gbc.gridy++;\r
+               //              twistedToUntwisted = gui.buildRadioButton( "twisted->untwisted", false);\r
+               //              twistedToUntwisted.addActionListener(this);\r
+               //              inputsPanel.add(twistedToUntwisted.getParent(), gbc);\r
+               //              group.add(twistedToUntwisted);\r
+               //\r
+               //\r
+               //              gbc.gridy++;\r
+               //              group = new ButtonGroup();\r
+               //              defaultCoords = gui.buildRadioButton("default coordinates", true);\r
+               //              inputsPanel.add(defaultCoords.getParent(), gbc);\r
+               //              group.add(defaultCoords);\r
+               //              gbc.gridy++;\r
+               //              noseCentric = gui.buildRadioButton("nose centered", false);\r
+               //              inputsPanel.add(noseCentric.getParent(), gbc);\r
+               //              group.add(noseCentric);\r
+               //              gbc.gridy++;\r
 \r
                JPanel panel = new JPanel(new BorderLayout());\r
                panel.add(inputsPanel, BorderLayout.NORTH);\r
                panel.add(regPanel, BorderLayout.CENTER);\r
                panel.add(dirPanel, BorderLayout.SOUTH);\r
-               \r
+\r
                getContentPane().add(panel, BorderLayout.NORTH);\r
 \r
                JPanel okCancelPanel = gui.buildOKCancelPanel();\r
@@ -813,11 +816,11 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
                                if (st.hasMoreTokens()) {\r
                                        pos.Z = Float.valueOf(st.nextToken());\r
                                        Vector3f out = new Vector3f();\r
-//                                     if ( noseCentric.isSelected() && (imageExtents != null) )\r
-//                                     {\r
-//                                             pos.X += imageExtents[0]/2;\r
-//                                             pos.Y += imageExtents[1]/2;\r
-//                                     }\r
+                                       //                                      if ( noseCentric.isSelected() && (imageExtents != null) )\r
+                                       //                                      {\r
+                                       //                                              pos.X += imageExtents[0]/2;\r
+                                       //                                              pos.Y += imageExtents[1]/2;\r
+                                       //                                      }\r
                                        out.copy(pos);\r
                                        text.add(out);\r
 \r
@@ -885,42 +888,42 @@ public class PlugInDialogUntwistedToTwisted extends JDialogStandalonePlugin impl
        {           \r
                straightenedAnnotationFile = straightenedAnnotationText.getText();\r
                targetDir = targetLocText.getText();\r
-               \r
+\r
                targetPointsFile = targetPointsText.getText();\r
                inputPointsFile = inputPointsText.getText();\r
 \r
                targetImageName = targetImageText.getText();\r
                inputImageName = inputImageText.getText();\r
-               \r
-//             baseFileDir = baseFileLocText.getText();\r
-//             includeRange = new Vector<Integer>();\r
-//             String rangeFusion = rangeFusionText.getText();\r
-//             if(rangeFusion != null) {  \r
-//                     String[] ranges = rangeFusion.split("[,;]");\r
-//                     for(int i=0; i<ranges.length; i++) {\r
-//                             String[] subset = ranges[i].split("-");\r
-//                             int lowerBound = -1, bound = -1;\r
-//                             for(int j=0; j<subset.length; j++) {\r
-//                                     try {\r
-//                                             bound = Integer.valueOf(subset[j].trim());\r
-//                                             if(lowerBound == -1) {\r
-//                                                     lowerBound = bound;\r
-//                                                     includeRange.add(lowerBound);\r
-//                                             } \r
-//                                     } catch(NumberFormatException e) {\r
-//                                             Preferences.debug("Invalid range specified: "+bound, Preferences.DEBUG_ALGORITHM);\r
-//                                     }\r
-//                             }\r
-//\r
-//                             for(int k=lowerBound+1; k<=bound; k++) {\r
-//                                     includeRange.add(k);\r
-//                             }\r
-//                     }\r
-//             }\r
-//\r
-//             if(includeRange.size() == 0) {\r
-//                     includeRange = null;\r
-//             }\r
+\r
+               //              baseFileDir = baseFileLocText.getText();\r
+               //              includeRange = new Vector<Integer>();\r
+               //              String rangeFusion = rangeFusionText.getText();\r
+               //              if(rangeFusion != null) {  \r
+               //                      String[] ranges = rangeFusion.split("[,;]");\r
+               //                      for(int i=0; i<ranges.length; i++) {\r
+               //                              String[] subset = ranges[i].split("-");\r
+               //                              int lowerBound = -1, bound = -1;\r
+               //                              for(int j=0; j<subset.length; j++) {\r
+               //                                      try {\r
+               //                                              bound = Integer.valueOf(subset[j].trim());\r
+               //                                              if(lowerBound == -1) {\r
+               //                                                      lowerBound = bound;\r
+               //                                                      includeRange.add(lowerBound);\r
+               //                                              } \r
+               //                                      } catch(NumberFormatException e) {\r
+               //                                              Preferences.debug("Invalid range specified: "+bound, Preferences.DEBUG_ALGORITHM);\r
+               //                                      }\r
+               //                              }\r
+               //\r
+               //                              for(int k=lowerBound+1; k<=bound; k++) {\r
+               //                                      includeRange.add(k);\r
+               //                              }\r
+               //                      }\r
+               //              }\r
+               //\r
+               //              if(includeRange.size() == 0) {\r
+               //                      includeRange = null;\r
+               //              }\r
 \r
                return true;\r
        }\r