use of cbit.image.ImageFile in project vcell by virtualcell.
the class PointSpreadFunctionManagement method ChoosePSFFile.
private void ChoosePSFFile(Hashtable<String, Object> hashTable) throws IOException, ImageException {
int returnVal = fc.showOpenDialog(parentWindow);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File filePSF = fc.getSelectedFile();
if (filePSF == null) {
throw new RuntimeException("Unable to open PSF file.");
}
String filePSFPath = filePSF.getCanonicalPath();
String filePSFNameExtended = filePSF.getName();
String initialFieldDataName = filePSFNameExtended.substring(0, filePSFNameExtended.indexOf("."));
// unused here but needed for some shared code
String mixedFieldDataName = initialFieldDataName + "Mx";
// // testing
// System.out.println("Reading file: "+filePSFPath);
ImageFile imagePSFFile = new ImageFile(filePSFPath);
// System.out.println("Writing Image "+filePSFName+".tif");
// imageFile.writeAsTIFF(filePSFName+".tif"); // no path specified, writes in current dir (vCell)
hashTable.put("filePSF", filePSF);
hashTable.put("initialFieldDataName", initialFieldDataName);
hashTable.put("mixedFieldDataName", mixedFieldDataName);
} else {
throw UserCancelException.CANCEL_GENERIC;
}
}