Fixed bug in annotation animation with spreadsheets.
authorabokinsky <abokinsky@ba61647d-9d00-f842-95cd-605cb4296b96>
Tue, 17 Apr 2018 15:53:56 +0000 (15:53 +0000)
committerabokinsky <abokinsky@ba61647d-9d00-f842-95cd-605cb4296b96>
Tue, 17 Apr 2018 15:53:56 +0000 (15:53 +0000)
git-svn-id: https://citdcbmipav.cit.nih.gov/repos-pub/mipav/trunk@15451 ba61647d-9d00-f842-95cd-605cb4296b96

mipav/src/plugins/PlugInDialogVolumeRender.java

index ad5ae48..ff84f05 100644 (file)
@@ -1279,9 +1279,11 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
 \r
                Vector3f min = new Vector3f(  Float.MAX_VALUE,  Float.MAX_VALUE,  Float.MAX_VALUE );\r
                Vector3f max = new Vector3f( -Float.MAX_VALUE, -Float.MAX_VALUE, -Float.MAX_VALUE );\r
-               int timeCount, maxTimeCount = -1, minTimeCount = Integer.MAX_VALUE;\r
-               int maxIndex = -1;\r
+//             int timeCount, maxTimeCount = -1, minTimeCount = Integer.MAX_VALUE;\r
+//             int maxIndex = -1;\r
                int fileIndex = 0;\r
+               int startTime = -1;\r
+               int endTime = -1;\r
                if (inputFileDir.exists() && inputFileDir.isDirectory()) {\r
                progress.setVisible(true);\r
                        String[] list = inputFileDir.list();\r
@@ -1304,9 +1306,7 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                                }\r
                                //                      System.err.println( annotationName );\r
 \r
-                               int startTime = -1;\r
-                               int endTime = -1;\r
-                               timeCount = 0;\r
+//                             timeCount = 0;\r
                                VOI annotation = new VOI( (short)i, annotationName, VOI.ANNOTATION, 0 );\r
                                Vector<Integer> times = new Vector<Integer>();\r
                                FileReader fr;\r
@@ -1345,11 +1345,14 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
 \r
                                                if ( time != -1 )\r
                                                {\r
-                                                       if ( startTime == -1 )\r
+                                                       if ( startTime > time )\r
                                                        {\r
                                                                startTime = time;\r
                                                        }\r
-                                                       endTime = time;\r
+                                                       if ( endTime < time )\r
+                                                       {\r
+                                                               endTime = time;\r
+                                                       }\r
                                                }\r
                                                if ( (time != -1) && (z >= 0) && (parsed.length > 3) )\r
                                                {\r
@@ -1362,11 +1365,12 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                                                        annotation.getCurves().add(text);\r
 \r
                                                        times.add( time );\r
-                                                       timeCount++;\r
+//                                                     timeCount++;\r
 \r
                                                        min.min( text.elementAt(0) );\r
                                                        max.max( text.elementAt(0) );\r
 \r
+//                                                     System.err.println( annotationName + "  " + time + "   " + x + "  " + y + "  " + z );\r
                                                        //                                              if ( text.elementAt(0).Z < 0 )\r
                                                        //                                              {\r
                                                        //                                                      System.err.println(list[i] );\r
@@ -1394,16 +1398,16 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                                        // TODO Auto-generated catch block\r
                                        e.printStackTrace();\r
                                }\r
-                               if ( timeCount < minTimeCount )\r
-                               {\r
-                                       minTimeCount = timeCount;\r
-                                       maxIndex = fileIndex;\r
-                               }\r
-                               if ( timeCount > maxTimeCount )\r
-                               {\r
-                                       maxTimeCount = timeCount;\r
-                                       maxIndex = fileIndex;\r
-                               }\r
+//                             if ( timeCount < minTimeCount )\r
+//                             {\r
+//                                     minTimeCount = timeCount;\r
+//                                     maxIndex = fileIndex;\r
+//                             }\r
+//                             if ( timeCount > maxTimeCount )\r
+//                             {\r
+//                                     maxTimeCount = timeCount;\r
+//                                     maxIndex = fileIndex;\r
+//                             }\r
                                fileIndex++;\r
                                progress.updateValueImmed((int) (100 * (float)fileIndex/(float)list.length));\r
                        }\r
@@ -1412,8 +1416,8 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                //        System.err.println( minTimeCount + " " + maxTimeCount + " " + (minTimeCount == maxTimeCount ) );\r
 \r
                //        System.err.println( timesList.size() + " " + tempList.size() );\r
-               int[] times = timesList.elementAt( maxIndex );\r
-               VOI curve = tempList.elementAt( maxIndex );\r
+//             int[] times = timesList.elementAt( maxIndex );\r
+//             VOI curve = tempList.elementAt( maxIndex );\r
                //              for ( int j = 0; j < times.length; j++ )\r
                //              {\r
                //                      System.err.println( curve.getName() + " " + times[j] );\r
@@ -1421,10 +1425,10 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
 \r
 \r
                annotationList = new VOIVector();\r
-               for ( int i = 0; i < times.length; i++ )\r
+               for ( int i = startTime; i <= endTime; i++ )\r
                {\r
-                       int timeStep = times[i];\r
-                       VOI annotation = new VOI( (short)i, "time" + timeStep, VOI.ANNOTATION, 0 );\r
+//                     int timeStep = times[i];\r
+                       VOI annotation = new VOI( (short)i, "time" + i, VOI.ANNOTATION, 0 );\r
 \r
                        //                      System.err.print( timeStep );\r
                        for ( int j = 0; j < timesList.size(); j++ )\r
@@ -1432,7 +1436,7 @@ public class PlugInDialogVolumeRender extends JFrame implements ActionListener,
                                int[] currentTimes = timesList.elementAt(j);\r
                                for ( int k = 0; k < currentTimes.length; k++ )\r
                                {\r
-                                       if ( timeStep == currentTimes[k] )\r
+                                       if ( i == currentTimes[k] )\r
                                        {\r
                                                VOIText text = new VOIText(tempList.elementAt(j).getCurves().elementAt(k));\r
 \r