Added debugging printouts for saving annotations. Fixed bug in loading creating the...
authorabokinsky <abokinsky@ba61647d-9d00-f842-95cd-605cb4296b96>
Fri, 9 Feb 2018 22:10:41 +0000 (22:10 +0000)
committerabokinsky <abokinsky@ba61647d-9d00-f842-95cd-605cb4296b96>
Fri, 9 Feb 2018 22:10:41 +0000 (22:10 +0000)
git-svn-id: https://citdcbmipav.cit.nih.gov/repos-pub/mipav/trunk@15370 ba61647d-9d00-f842-95cd-605cb4296b96

mipav/src/gov/nih/mipav/view/renderer/WildMagic/WormUntwisting/LatticeModel.java
mipav/src/plugins/PlugInDialogVolumeRender.java

index 540be57..4f4de84 100644 (file)
@@ -122,6 +122,9 @@ public class LatticeModel {
         */\r
        public static void saveAnnotationsAsCSV(final String dir, final String fileName, VOI annotations)\r
        {\r
+               Preferences.debug("Saving annotations list: " + "\n", Preferences.DEBUG_ALGORITHM );\r
+               System.err.println("Saving annotations list: " );\r
+               int numSaved = 0;\r
                // check files, create new directories and delete any existing files:\r
                final File fileDir = new File(dir);\r
 \r
@@ -152,6 +155,8 @@ public class LatticeModel {
                                VOIText annotation = (VOIText)annotations.getCurves().elementAt(i);\r
                                Vector3f position = annotation.elementAt(0);\r
                                bw.write(annotation.getText() + "," + position.X + "," + position.Y + ","       + position.Z + "\n");\r
+                               Preferences.debug(numSaved + "   " + annotation.getText() + "\n", Preferences.DEBUG_ALGORITHM );\r
+                               System.err.println( numSaved++ + "   " + annotation.getText() );\r
                        }\r
                        bw.newLine();\r
                        bw.close();\r
@@ -159,7 +164,8 @@ public class LatticeModel {
                        System.err.println("CAUGHT EXCEPTION WITHIN saveSeamCellsTo");\r
                        e.printStackTrace();\r
                }\r
-\r
+               Preferences.debug("Annotation written: " + numSaved + "\n", Preferences.DEBUG_ALGORITHM );\r
+               System.err.println( "Annotation written: " + numSaved );\r
        }\r
        \r
        public static VOIVector readLatticeCSV(String fileName) {\r
index f939877..2389275 100644 (file)
@@ -226,8 +226,16 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                        {\r
                                if ( includeRange == null )\r
                                {\r
-                                       MipavUtil.displayError( "Please specify a range of images." );\r
-                                       return;\r
+                                       if ( createAnimation.isSelected() )\r
+                                       {\r
+                                               // Launch the animation tool\r
+                                               this.setVisible(false);\r
+                                               annotationAnimationFromSpreadSheet();\r
+                                       }\r
+                                       else {\r
+                                               MipavUtil.displayError( "Please specify a range of images." );\r
+                                               return;\r
+                                       }\r
                                }\r
                                startButton.setEnabled(false);\r
                                if ( segmentSeamCells.isSelected() )\r
@@ -368,12 +376,6 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                                                openStraightened();\r
                                        }\r
                                }\r
-                               else if ( createAnimation.isSelected() )\r
-                               {\r
-                                       // Launch the animation tool\r
-                                       this.setVisible(false);\r
-                                       annotationAnimationFromSpreadSheet();\r
-                               }\r
                        }\r
 \r
                        baseFileNameText.setEnabled( !createAnimation.isSelected() );\r
@@ -1247,8 +1249,7 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                VOIVector tempList = new VOIVector();\r
                Vector< int[] > timesList = new Vector< int[] >();\r
                ViewJProgressBar progress = new  ViewJProgressBar( "Generating Animation", "", 0, 100, false);\r
-               progress.dispose();\r
-               progress = null;\r
+        MipavUtil.centerOnScreen(progress);\r
 \r
                String inputDirName = baseFileDir + File.separator;\r
                //              System.err.println( inputDirName );\r
@@ -1260,6 +1261,7 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                int maxIndex = -1;\r
                int fileIndex = 0;\r
                if (inputFileDir.exists() && inputFileDir.isDirectory()) {\r
+               progress.setVisible(true);\r
                        String[] list = inputFileDir.list();\r
                        for ( int i = 0; i < list.length; i++ )\r
                        {\r
@@ -1381,6 +1383,7 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                                        maxIndex = fileIndex;\r
                                }\r
                                fileIndex++;\r
+                               progress.updateValueImmed((int) (100 * (float)fileIndex/(float)list.length));\r
                        }\r
                }\r
 \r
@@ -1468,10 +1471,14 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                } else { // voiFileDir does not exist\r
                        outputFileDir.mkdir();\r
                }\r
-\r
+               \r
+               progress.setTitle("Creating Animation Viewer..." );\r
                animationImage.setImageDirectory( outputDirName );              \r
                triVolume = new VolumeTriPlanarInterface(animationImage, null);\r
                triVolume.addConfiguredListener(this);\r
+\r
+               progress.dispose();\r
+               progress = null;\r
        }\r
 \r
        /**\r