From: <tr...@us...> - 2003-02-13 11:36:55
|
Update of /cvsroot/basedb/basedb/include/classes In directory sc8-pr-cvs1:/tmp/cvs-serv1522/include/classes Modified Files: acquisition.inc.php image.inc.php spotimage.inc.php Log Message: Updated image channel handling Index: acquisition.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/include/classes/acquisition.inc.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** acquisition.inc.php 13 Feb 2003 08:47:45 -0000 1.13 --- acquisition.inc.php 13 Feb 2003 11:36:52 -0000 1.14 *************** *** 191,195 **** while($row =& db_fetch_row($res)) $arr[] = $row[0]; ! if(count($arr) == 1 && $arr[0] == 3) return true; if(count($arr) == 2 && $arr[0] == 1 && $arr[1] == 2) --- 191,195 ---- while($row =& db_fetch_row($res)) $arr[] = $row[0]; ! if(count($arr) == 1 && $arr[0] == IMAGE_CHANNEL_BOTH) return true; if(count($arr) == 2 && $arr[0] == 1 && $arr[1] == 2) *************** *** 204,213 **** $query = "SELECT i.channels, i.id FROM Image i ". "WHERE i.`imageAcquisition` = $this->id ". ! "AND i.channels IN (1,2,3) ". Item::whereRemovedAnd("i", 0)." ". "ORDER BY channels"; $res = query($query); $arr = array(); ! $imgs = array(1 => 0, 2 => 0, 3 => 0); while($row =& db_fetch_row($res)) { --- 204,213 ---- $query = "SELECT i.channels, i.id FROM Image i ". "WHERE i.`imageAcquisition` = $this->id ". ! "AND i.channels IN (1, 2, ".IMAGE_CHANNEL_BOTH.") ". Item::whereRemovedAnd("i", 0)." ". "ORDER BY channels"; $res = query($query); $arr = array(); ! $imgs = array(1 => 0, 2 => 0, IMAGE_CHANNEL_BOTH => 0); while($row =& db_fetch_row($res)) { *************** *** 218,227 **** if($imgs[1] >= 1 && $imgs[2] >= 1) $found++; ! if($imgs[3] >= 1) $found++; if(!$found) return 1; ! if($found > 1 || $imgs[1] > 1 || $imgs[2] > 1 || $imgs[3] > 1) return 2; for($i = 0; $i < count($arr); $i++) --- 218,230 ---- if($imgs[1] >= 1 && $imgs[2] >= 1) $found++; ! if($imgs[IMAGE_CHANNEL_BOTH] >= 1) $found++; if(!$found) return 1; ! if($found > 1 || $imgs[1] > 1 || $imgs[2] > 1 || ! $imgs[IMAGE_CHANNEL_BOTH] > 1) ! { return 2; + } for($i = 0; $i < count($arr); $i++) Index: image.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/include/classes/image.inc.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** image.inc.php 3 Feb 2003 20:13:18 -0000 1.14 --- image.inc.php 13 Feb 2003 11:36:52 -0000 1.15 *************** *** 26,29 **** --- 26,35 ---- define("CLEN_IMAGE_NAME", 255); + define("IMAGE_CHANNEL_NONE", 0); + define("IMAGE_CHANNEL_ALL", -1); + define("IMAGE_CHANNEL_OTHER", -2); + define("IMAGE_CHANNEL_BOTH", -3); + define("IMAGE_CHANNEL_MAX", 8); + class Image extends Item { *************** *** 91,95 **** function setChannels($val) { ! $this->channels = (int)$val; } function setFileSize($val) --- 97,102 ---- function setChannels($val) { ! $this->channels = max(IMAGE_CHANNEL_BOTH, ! min(IMAGE_CHANNEL_MAX, (int)$val)); } function setFileSize($val) *************** *** 187,191 **** $arr = array(); while($row =& db_fetch_row($res)) ! $arr[$row[0]] = $row[1]; return $arr; } --- 194,198 ---- $arr = array(); while($row =& db_fetch_row($res)) ! $arr[(int)$row[0]] = $row[1]; return $arr; } *************** *** 212,219 **** function getChannelNames() { ! $names = array(-1 => "All", -3 => "Both", 0 => "None"); ! for($i = 1; $i < 9; $i++) $names[$i] = "Ch $i"; ! $names[-2] = "Other"; return $names; } --- 219,228 ---- function getChannelNames() { ! $names = array(IMAGE_CHANNEL_ALL => "All", ! IMAGE_CHANNEL_BOTH => "Ch1 and 2", ! IMAGE_CHANNEL_NONE => "None"); ! for($i = 1; $i <= IMAGE_CHANNEL_MAX; $i++) $names[$i] = "Ch $i"; ! $names[IMAGE_CHANNEL_OTHER] = "Other"; return $names; } Index: spotimage.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/include/classes/spotimage.inc.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** spotimage.inc.php 3 Feb 2003 20:13:19 -0000 1.9 --- spotimage.inc.php 13 Feb 2003 11:36:52 -0000 1.10 *************** *** 98,102 **** // $imgs is an array with either two images (keys 1 and 2) or one image ! // (key -3). function runSpotImageChopper($dir, $imgs) { --- 98,102 ---- // $imgs is an array with either two images (keys 1 and 2) or one image ! // (key IMAGE_CHANNEL_BOTH). function runSpotImageChopper($dir, $imgs) { *************** *** 135,139 **** { echo "Splitting two-channel TIFF image\n"; ! $imgBoth = $imgs[-3]; $fileBoth = escapeshellarg( Image::getRepositoryFilenameById($imgBoth)); --- 135,139 ---- { echo "Splitting two-channel TIFF image\n"; ! $imgBoth = $imgs[IMAGE_CHANNEL_BOTH]; $fileBoth = escapeshellarg( Image::getRepositoryFilenameById($imgBoth)); *************** *** 184,188 **** return "Spot images already exist or are being processed"; $imgs = Image::getBriefForJpeg($raw->getImageAcquisition()); ! if(count($imgs) == 1 && isset($imgs[-3])) ; else if(count($imgs) == 2 && isset($imgs[1]) && isset($imgs[2])) --- 184,188 ---- return "Spot images already exist or are being processed"; $imgs = Image::getBriefForJpeg($raw->getImageAcquisition()); ! if(count($imgs) == 1 && isset($imgs[IMAGE_CHANNEL_BOTH])) ; else if(count($imgs) == 2 && isset($imgs[1]) && isset($imgs[2])) *************** *** 196,200 **** { $BC->endTransaction(); ! return "Unable to lock data set for spot image processing"; } $dir = $raw->getSpotImageDirectory(true); --- 196,200 ---- { $BC->endTransaction(); ! return "Unable to lock raw data set for spot image processing"; } $dir = $raw->getSpotImageDirectory(true); |