Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
aarpon committed Apr 4, 2024
2 parents f215b19 + 965920b commit b40f2a8
Show file tree
Hide file tree
Showing 14 changed files with 288 additions and 37 deletions.
7 changes: 7 additions & 0 deletions ajax/json-rpc-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,11 @@ function jsonGetFileFormats()
$translations = array();
foreach ($formats as $key => $format) {
$translations[$key] = $fileFormat->translatedValueFor($format);

// Ensure "all" is on top. Temporarily set to zeroes.
if ($format == "all") {
$translations[$key] = "000";
}
}

// This sort function maintains the key/value associations.
Expand All @@ -918,7 +923,9 @@ function jsonGetFileFormats()
foreach ($translations as $key => $translation) {
$format = $formats[$key];

// Restore "all" text and append please choose text.
if ($format == "all") {
$translation = $fileFormat->translatedValueFor($format);
$translation .= " Please choose a file format ...";
}

Expand Down
7 changes: 6 additions & 1 deletion credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
ETH Zurich</a>;
</li>
<li>
<b>Daniel Sevilla</b>,
<b>Kevin Namink</b>,
<a href="https://www.svi.nl" onclick="this.target='_blank'; return true;">
Scientific Volume Imaging</a>;
</li>
Expand Down Expand Up @@ -126,6 +126,11 @@

<h2>Former developers</h2>
<ul>
<li>
<b>Daniel Sevilla</b>,
<a href="https://www.svi.nl" onclick="this.target='_blank'; return true;">
Scientific Volume Imaging</a>;
</li>
<li>
<b>Asheesh Gulati</b>,
<a href="https://biop.epfl.ch/" onclick="this.target='_blank'; return true;">
Expand Down
7 changes: 5 additions & 2 deletions inc/DatabaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,9 @@ public function addFileToJob($id, $owner, $file, $autoseries)
$sqlAutoSeries = "T";
}
$slashesFile = addslashes($file);
if (strlen($slashesFile) > 191) {
Log::error("File name too long!");
}
$query = "insert into job_files values ('$id', '$username', '$slashesFile', '$sqlAutoSeries')";
$result = $result && $this->execute($query);
return $result;
Expand Down Expand Up @@ -1449,7 +1452,6 @@ public function updateStatistics(Job $job, $startTime)
$taskSetting = $desc->taskSetting();
$analysisSetting = $desc->analysisSetting();

$stopTime = date("Y-m-d H:i:s");
$id = $desc->id();
/** @var UserV2 $user */
$user = $desc->owner();
Expand All @@ -1467,8 +1469,9 @@ public function updateStatistics(Job $job, $startTime)
$parameter = $analysisSetting->parameter('ColocAnalysis');
$colocAnalysis = $parameter->value();

// Note: both startTime and endTime are now set in database time.
$query = "insert into statistics values ('$id', '$owner', '$group', " .
"'$startTime', '$stopTime', '$inFormat', '$outFormat', " .
"'$startTime', NOW(), '$inFormat', '$outFormat', " .
"'$PSF', '$microscope', '$colocAnalysis')";

$this->execute($query);
Expand Down
6 changes: 3 additions & 3 deletions inc/FileBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ class="selection"
"DestinationFolder" : "<?php echo($_SESSION['fileserver']->sourceFolder()); ?>",
"ImageExtensions" : ['dv', 'ims', 'lif', 'lof', 'lsm', 'vsi', 'oif', 'pic', 'r3d', 'stk',
'zvi', 'czi', 'nd2', 'nd', 'tf2', 'tf8', 'btf', 'h5', 'tif', 'tiff', 'ome.tif',
'ome.tiff', 'ome', 'ics', 'ids']
'ome.tiff', 'ome', 'msr', 'obf', 'ics', 'ids']
}
},
chunking: {
Expand All @@ -554,10 +554,10 @@ class="selection"
stopOnFirstInvalidFile: false,
sizeLimit: totalAllowedSizeOfSingleFile,
acceptFiles: ".dv,.ims,.lif,.lof,.lsm,.vsi,.oif,.pic,.3rd,.stk,.zvi,.czi,.nd2,.nd,.tf2,.tf8,.btf,.h5," +
".tif,.tiff,.ome.tif,.ome.tiff,.ics,.ids,.zip,.tgz,.tar,.tar.gz",
".tif,.tiff,.ome.tif,.ome.tiff,.msr,.obf,.ics,.ids,.zip,.tgz,.tar,.tar.gz",
allowedExtensions: ['dv', 'ims', 'lif', 'lof', 'lsm', 'vsi', 'oif', 'pic', 'r3d', 'stk',
'zvi', 'czi', 'nd2', 'nd', 'tf2', 'tf8', 'btf', 'h5', 'tif', 'tiff', 'ome.tif',
'ome.tiff', 'ome', 'ics', 'ids', 'zip', 'tgz', 'tar', 'tar.gz'],
'ome.tiff', 'ome', 'msr', 'obf', 'ics', 'ids', 'zip', 'tgz', 'tar', 'tar.gz'],
},
resume: {
enabled: true
Expand Down
4 changes: 4 additions & 0 deletions inc/Fileserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ public function fileToConfidenceLevelFormat($file)
case 'czi':
case 'nd2':
case 'nd':
case 'msr':
case 'obf':
case 'hdf5':
case 'ics':
$fileFormat = $fileExtension;
Expand Down Expand Up @@ -314,6 +316,8 @@ public function checkAgainstFormat($file, $selectedFormat)
case 'tf2':
case 'tf8':
case 'btf':
case 'msr':
case 'obf':
$fileFormat = $fileExtension;
break;
case 'h5':
Expand Down
16 changes: 13 additions & 3 deletions inc/HuygensTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -1189,9 +1189,15 @@ private function getImgTaskDescrChromatic()
case 'lambdaEx':
case 'lambdaSted':
case 'mType':
case 'estMethod':
$taskDescr .= $chromValue;
break;
case 'estMethod':
if ($chromaticParam->componentCnt() > 5) {
$taskDescr .= '6';
} else {
$taskDescr .= $chromValue;
}
break;
case 'channel':
$taskDescr .= $chan;
break;
Expand Down Expand Up @@ -2391,7 +2397,11 @@ private function getTaskDescrColoc($chanR, $chanG, $runCnt)
$taskDescr .= $this->string2tcllist($coefficients);
break;
case 'map':
$taskDescr .= $this->getColocMap();
if ($this->getColocMap() == "") {
$taskDescr .= "none";
} else {
$taskDescr .= $this->getColocMap();
}
break;
case 'destDir':
$destDir = $this->getDestDir() . "/hrm_previews";
Expand Down Expand Up @@ -3309,7 +3319,7 @@ private function setSrcImage()

/*If a (string) comes after the file name, the string is interpreted
as a subimage. Currently this is for LIF, LOF and CZI files only. */
if (preg_match("/^(.*\.(lif|czi|lof|nd))\s\((.*)\)/i",
if (preg_match("/^(.*\.(lif|czi|lof|nd|msr|obf))\s\((.*)\)/i",
$this->srcImage, $match)) {
$this->srcImage = $match[1];
$this->subImage = $match[3]; // @todo Is this correct?
Expand Down
10 changes: 5 additions & 5 deletions inc/QueueManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function copyImagesToServer(Job $job, $server_hostname)
foreach ($files as $file) {
$counter++;
$match = array();
if (preg_match("/^(.*\.(lif|lof|czi|nd))\s\((.*)\)/i", $file, $match)) {
if (preg_match("/^(.*\.(lif|lof|czi|nd|obf|msr))\s\((.*)\)/i", $file, $match)) {
$filteredFiles[$counter] = $match[1];
} else {
$filteredFiles[$counter] = $file;
Expand Down Expand Up @@ -808,9 +808,9 @@ public function updateJobAndServerStatus()
// Remove all the transferred files from the processing server.
$this->cleanUpRemoteServer($job);

// Reset server and remove job from the job queue
// Reset server and remove job from the job queue.
$this->stopTime = $queue->stopJob($job);
$this->assembleJobLogFile($job, $startTime, $logFile, $errorFile);
$this->assembleJobLogFile($job, $startTime, $this->stopTime, $logFile, $errorFile);

// Write email
if ($send_mail) {
Expand Down Expand Up @@ -838,7 +838,7 @@ public function updateJobAndServerStatus()
* @param string $errorFile Full path to the errorlog file.
* @return string Job log to be displayed.
*/
public function assembleJobLogFile($job, $startTime, $logFile, $errorFile)
public function assembleJobLogFile($job, $startTime, $endTime, $logFile, $errorFile)
{
$result = false;
$desc = $job->description();
Expand All @@ -855,7 +855,7 @@ public function assembleJobLogFile($job, $startTime, $logFile, $errorFile)
// Message
$text = '';
$text .= "Job id: $id (pid $pid on $server), started " .
"at $startTime and finished at " . date("Y-m-d H:i:s") . "\n\n";
"at $startTime and finished at $endTime \n\n";

if (file_exists($errorFile)) {
$text .= "- HUYGENS ERROR REPORT (stderr) --------------\n\n" . file_get_contents($errorFile);
Expand Down
4 changes: 2 additions & 2 deletions inc/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class System
* Current HRM minor version. This value has to be set by the developers!
* @var int
*/
private const HRM_VERSION_MINOR = 9;
private const HRM_VERSION_MINOR = 10;

/**
* Current HRM maintenance (patch) version. This value has to be set by the
Expand All @@ -49,7 +49,7 @@ class System
* set by the developers!
* @var int
*/
private const DB_LAST_REVISION = 20;
private const DB_LAST_REVISION = 21;

/**
* Minimum HuCore (major) version number to be compatible with HRM.
Expand Down
20 changes: 11 additions & 9 deletions inc/job/JobDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,19 +499,14 @@ public function sourceImageShortName()
{
$files = $this->files();
$inputFile = end($files);
// Handle subfolders.
$inputFile = explode("/", $inputFile);
// remove file extension
//$inputFile = explode(".", end($inputFile));
//$inputFile = $inputFile[0];
//$parameterSetting = $this->parameterSetting;
//$parameter = $parameterSetting->parameter('ImageFileFormat');
//$fileFormat = $parameter->value();
if (preg_match("/^(.*)\.(lif|lof|czi|nd)\s\((.*)\)/i", $inputFile[0], $match)) {
// Match for container files.
if (preg_match("/^(.*)\.(lif|lof|czi|nd|msr|obf)\s\((.*)\)/i", end($inputFile), $match)) {
$inputFile = $match[1] . '_' . $match[2] . '_' . $match[3];
} else {
$inputFile = substr(end($inputFile), 0, strrpos(end($inputFile), "."));
}

return $inputFile;
}

Expand Down Expand Up @@ -546,7 +541,14 @@ public function destinationImageName()
// (see http://stackoverflow.com/questions/4636166/ for more details)
$tmp = explode($taskSetting->name(), $this->sourceImageShortName());
$outputFile = end($tmp);
$outputFile = str_replace(" ", "_", $outputFile);
$outputFile = str_replace(array(" ",":"), "_", $outputFile);
// Max final file name length is 128 characters, truncate if
// necessary. Reserve enough space for all possible extra suffixes.
$pathInfo = pathinfo($outputFile);
if (strlen($pathInfo['basename']) > 76) {
$outputFile = $pathInfo['dirname'] . "/";
$outputFile .= substr($pathInfo['basename'], 0, 70) . "_trunc";
}
$result = $outputFile . "_" . $this->id() . "_hrm";
# Add a non-numeric string at the end: if the task name ends with a
# number, that will be removed when saving using some file formats that
Expand Down
19 changes: 17 additions & 2 deletions inc/param/ChromaticAberration.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function componentCnt()
*/
public function shownComponentCnt()
{
return $this->componentCnt();
return 5;
}

/**
Expand Down Expand Up @@ -127,7 +127,7 @@ public function isVariableChannel()
public function displayString($chanCnt = 0)
{
// Don't show anything when the channel is irrelevant.
if ($this->channel > $chanCnt) {
if ($this->channel >= $chanCnt) {
return "";
}
return rtrim($this->value->displayString(), ", \n\r\t\v\x00"). "\n";
Expand Down Expand Up @@ -168,6 +168,21 @@ public function setValue($values)
$valuesArray = array("0","0","0","0","1",null,null,null,
null,null,null,null,null,null);
}

// If only 5 values are present, fill the rest with nulls.
if (sizeof($valuesArray) == 5) {
array_push($valuesArray,
null,null,null,null,null,null,null,null,null);
$this->componentCnt = 5;
} else {
$this->componentCnt = 14;
foreach ($valuesArray as $val) {
if ($val == null || $val == "") {
$this->componentCnt = 5;
break;
}
}
}

//error_log(implode('_', $valuesArray));
$this->value->setValue($valuesArray);
Expand Down
12 changes: 8 additions & 4 deletions post_processing.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ class="selection"
<td class="header">Shift y<br/>(&#956m)</td>
<td class="header">Shift z<br/>(&#956m)</td>
<td class="header">Rotation<br/>(degrees)</td>
<td class="header">Scale<br/>(ratio)</td>
<td class="header" id="ChromaticAberrationScaleTitle"><?php
if ($chromaticParam[1]->value()[13] == null) {
echo 'Scale<br/>(ratio)';
} else {
echo 'Scale<br/>(dB)';
}?></td>
</tr>

<?php
Expand All @@ -183,13 +188,12 @@ class="selection"

for ($component = 0; $component < $shownComponentCnt; $component++) {
?>

<td><input
id="ChromaticAberrationCh<?php echo $chan . '_' . $component; ?>"
name="ChromaticAberrationCh<?php echo $chan . '_' . $component; ?>"
title="Channel <?php echo $chan; ?>, component <?php echo $component; ?>"
type="text"
size="1"
size="8"
value="<?php echo $chromaticParam[$chan]->value()[$component]; ?>"
class="multichannelinput"/></td>
<?php
Expand All @@ -201,7 +205,7 @@ class="multichannelinput"/></td>
name="ChromaticAberrationDiscardOtherCh<?php echo $chan?>"
title="Discard this channel's other components to edit the remaining"
value="Discard other"
<?php if ($chromaticParam[$chan]->value()[13] == null) { echo 'hidden=true'; }?>
<?php if ($chromaticParam[$chan]->componentCnt() == 5) { echo 'hidden=true'; }?>
onclick="editChromaticChannelWith14Params(<?php echo $chan?>)"/></td>
</tr>
<?php
Expand Down
18 changes: 15 additions & 3 deletions scripts/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ function editChromaticChannelWith14Params(channel) {
butElement.setAttribute('hidden', true);
clearChromaticChannelReference( );

scaleElement = document.getElementById("ChromaticAberrationScaleTitle");
scaleElement.innerHTML = 'Scale<br/>(ratio)';

// Round the values to 5 decimals. This both makes it easier to edit and
// ensures the new values are saved properly.
var tableTag = "ChromaticAberrationTable";
Expand All @@ -328,7 +331,12 @@ function editChromaticChannelWith14Params(channel) {
for (var component = 0; component < componentCnt; component++) {
var id = channelTag + "Ch" + channel + "_" + component;
inputElement = document.getElementById(id);
var rounded = Math.round(inputElement.value * 100000) / 100000;
if (component == 4) {
var rounded = Math.round(Math.pow(10, inputElement.value / 10)
* 100000) / 100000;
} else {
var rounded = Math.round(inputElement.value * 100000) / 100000;
}
inputElement.value = rounded;
}

Expand All @@ -351,7 +359,9 @@ function updateDeconEntryProperties( ) {
"SignalNoiseRatioGMLE",
"SignalNoiseRatioSKIP",
"Acuity",
"BackgroundOffsetPercent"];
"BackgroundOffsetPercent",
"q",
"it"];

var skipAllChannels = true;

Expand Down Expand Up @@ -566,7 +576,7 @@ function checkAgainstFormat(file, selectedFormat) {

// Pattern ome.tiff = (\.([^\..]+))*
// Pattern file extension: = \.([A-Za-z0-9]+)
// Pattern lif, czi subimages: = (\s\(.*\))*
// Pattern lif, czi, obf subimages: = (\s\(.*\))*

var nameDivisions;
nameDivisions = file.match(/(\.([^\..]+))*\.([A-Za-z0-9]+)(\s\(.*\))*$/);
Expand Down Expand Up @@ -606,6 +616,8 @@ function checkAgainstFormat(file, selectedFormat) {
case 'tf2':
case 'tf8':
case 'btf':
case 'msr':
case 'obf':
fileFormat = fileExtension;
break;
case 'h5':
Expand Down
Loading

0 comments on commit b40f2a8

Please sign in to comment.