use of cbit.image.VCPixelClass in project vcell by virtualcell.
the class GeomDbDriver method getImageRegionsForVCImage.
/**
* This method was created in VisualAge.
* @param vcImage cbit.image.VCImage
*/
private void getImageRegionsForVCImage(QueryHashtable dbc, Connection con, VCImage vcImage) throws SQLException, DataAccessException {
String sql;
sql = " SELECT *" + //
" FROM " + imageRegionTable.getTableName() + //
" WHERE " + imageRegionTable.imageRef + " = " + vcImage.getVersion().getVersionKey() + " ORDER BY " + imageRegionTable.id;
//
// System.out.println(sql);
//
// Connection con = conFact.getConnection();
Statement stmt = con.createStatement();
try {
ResultSet rset = stmt.executeQuery(sql);
//
// get vcPixelClass objects and give them to vcImage
//
Vector<VCPixelClass> vcpcVector = new Vector<VCPixelClass>();
while (rset.next()) {
KeyValue vcpcKey = new KeyValue(rset.getBigDecimal(imageRegionTable.id.toString()));
//
// try to get PixelClass from object cache
//
VCPixelClass vcpc = (VCPixelClass) dbc.get(vcpcKey);
if (vcpc == null) {
String vcpcName = rset.getString(imageRegionTable.regionName.toString());
int vcpcPixVal = new Integer(rset.getInt(imageRegionTable.pixelValue.toString())).intValue();
vcpc = new VCPixelClass(vcpcKey, vcpcName, vcpcPixVal);
//
// put the ImageRegion in the object cache
//
dbc.put(vcpcKey, vcpc);
}
vcpcVector.addElement(vcpc);
}
VCPixelClass[] vcPixelClasses = (VCPixelClass[]) BeanUtils.getArray(vcpcVector, VCPixelClass.class);
vcImage.setPixelClasses(vcPixelClasses);
if (vcImage instanceof VCImageCompressed) {
// Fix out of memory error when a BioModel has many apps with large geometries
((VCImageCompressed) vcImage).nullifyUncompressedPixels();
}
} catch (PropertyVetoException e) {
throw new DataAccessException(e.getMessage());
} finally {
// Release resources include resultset
stmt.close();
}
}
use of cbit.image.VCPixelClass in project vcell by virtualcell.
the class ImageRegionTable method getVCPixelClass.
/**
* This method was created in VisualAge.
* @return Model
* @param rset ResultSet
* @param log SessionLog
*/
public VCPixelClass getVCPixelClass(ResultSet rset, SessionLog log) throws SQLException {
KeyValue key = new KeyValue(rset.getBigDecimal(id.toString()));
String rName = rset.getString(regionName.toString());
int pixValue = rset.getInt(pixelValue.toString());
VCPixelClass vcPixelClass = new VCPixelClass(key, rName, pixValue);
return vcPixelClass;
}
Aggregations