コード例 #1
0
 /** Disposes of the tagged images in the imagestorage */
 @Override
 public void close() {
   shutdownHook_.run();
   Runtime.getRuntime().removeShutdownHook(shutdownHook_);
   for (MultipageTiffReader r : new HashSet<MultipageTiffReader>(tiffReadersByLabel_.values())) {
     try {
       r.close();
     } catch (IOException ex) {
       ReportingUtils.logError(ex);
     }
   }
 }
コード例 #2
0
 @Override
 public void writeDisplaySettings() {
   for (MultipageTiffReader r : new HashSet<MultipageTiffReader>(tiffReadersByLabel_.values())) {
     try {
       r.rewriteDisplaySettings(displayAndComments_.getJSONArray("Channels"));
       r.rewriteComments(displayAndComments_.getJSONObject("Comments"));
     } catch (JSONException ex) {
       ReportingUtils.logError("Error writing display settings");
     } catch (IOException ex) {
       ReportingUtils.logError(ex);
     }
   }
 }
コード例 #3
0
 private void openExistingDataSet() throws IOException {
   // Need to throw error if file not found
   MultipageTiffReader reader = null;
   File dir = new File(directory_);
   for (File f : dir.listFiles()) {
     if (f.getName().endsWith(".tif") || f.getName().endsWith(".TIF")) {
       reader = new MultipageTiffReader(f);
       Set<String> labels = reader.getIndexKeys();
       for (String label : labels) {
         tiffReadersByLabel_.put(label, reader);
         int frameIndex = Integer.parseInt(label.split("_")[2]);
         lastFrameOpenedDataSet_ = Math.max(frameIndex, lastFrameOpenedDataSet_);
       }
     }
   }
   try {
     setSummaryMetadata(reader.getSummaryMetadata());
     numPositions_ = MDUtils.getNumPositions(summaryMetadata_);
     displayAndComments_ = reader.getDisplayAndComments();
   } catch (JSONException ex) {
     ReportingUtils.logError(ex);
   }
 }