Exemplo n.º 1
0
function getImageROIList($image_pid, $nothing, $workflow_id)
{
    global $user;
    $returnHTML = "";
    if (Workflow_Users::doesWorkflowHaveUserName($workflow_id, $user->name) && Workflow_Permission::doesWorkflowHavePermission($workflow_id, "canAnalyzeSpecimen")) {
        $roi_pids = AP_Image::getROIListForImage($image_pid);
        foreach ($roi_pids as $roi_pid) {
            $roiMetadata_record = AP_ROI::getroiMetadata_record($roi_pid);
            $roiURL = $roiMetadata_record['roiURL'];
            $changedHeight = thumbHeightReset($roiMetadata_record['h'], $roiMetadata_record['w']);
            if (!$changedHeight) {
                if (strpos($roiURL, 'rft_id') > -1) {
                    $roi_thumb_url = scaleDjatokaURL($roiURL, '78', '0');
                } else {
                    $roi_thumb_url = getDjatokaURL($roiMetadata_record['sourceURL'], 'getRegion', '100', $roiMetadata_record['y'], $roiMetadata_record['x'], $roiMetadata_record['h'], $roiMetadata_record['w'], '78', '0');
                }
            } else {
                if (strpos($roiURL, 'rft_id') > -1) {
                    $next_amp = strpos($roiURL, '&', strpos($roiURL, 'rft_id'));
                    $rft_id = substr($roiURL, strpos($roiURL, 'rft_id') + strlen('rft_id') + 1, $next_amp - (strpos($roiURL, 'rft_id') + strlen('rft_id') + 1));
                    $roi_thumb_url = getDjatokaURL($rft_id, 'getRegion', '100', $roiMetadata_record['y'], $roiMetadata_record['x'], $changedHeight, $roiMetadata_record['w'], '78', '0');
                } else {
                    $roi_thumb_url = getDjatokaURL($roiMetadata_record['sourceURL'], 'getRegion', '100', $roiMetadata_record['y'], $roiMetadata_record['x'], $changedHeight, $roiMetadata_record['w'], '78', '0');
                }
            }
            $status_dom = AP_ROI::getROIStatusDom($roi_pid);
            $transcribed_status = $status_dom->getElementsByTagName("transcribedStatus")->item(0)->nodeValue;
            $parsed_status = $status_dom->getElementsByTagName("parsedL1Status")->item(0)->nodeValue;
            if ($transcribed_status == "") {
                $transcribed_status = "Undefined";
            }
            if ($parsed_status == "") {
                $parsed_status = "Undefined";
            }
            $returnHTML .= generate_roi_html($roi_pid, $roi_thumb_url, $roiMetadata_record, $transcribed_status, $parsed_status, $workflow_id);
        }
    } else {
        //http_send_status(401);
        $returnHTML = "You do not have sufficient permission";
    }
    echo $returnHTML;
}
Exemplo n.º 2
0
function get_parsing_content($roi_pid, $size, $parse_level, $workflow_id)
{
    global $user;
    list($height, $width) = explode(":", $size);
    if (Workflow_Users::doesWorkflowHaveUserName($workflow_id, $user->name) && Workflow_Permission::doesWorkflowHavePermission($workflow_id, $parse_level)) {
        $roiMetadata_record = AP_ROI::getroiMetadata_record($roi_pid);
        $roiURL = $roiMetadata_record['roiURL'];
        if ($height > $roiMetadata_record['h'] / $roiMetadata_record['w'] * $width) {
            $roi_image_url = scaleDjatokaURL($roiURL, $width, '0');
            $image_html = "<img class='transcribe_roi_image' src='{$roi_image_url}' />";
        } else {
            $roi_image_url = scaleDjatokaURL($roiURL, '0', $height);
            $image_html = "<img class='transcribe_roi_image' src='{$roi_image_url}' />";
        }
        $roi_obj = new roiHandler($roi_pid);
        $returnJSON['text'] = "";
        if ($roi_obj->ifExist("Text")) {
            $text = nl2br($roi_obj->getDatastream("Text"));
        }
    } else {
        return false;
    }
    return array($image_html, $text);
}
Exemplo n.º 3
0
function get_transcribe_content($roi_pid, $size, $workflow_id)
{
    global $user;
    list($height, $width) = explode(":", $size);
    $returnJSON = "";
    if (Workflow_Users::doesWorkflowHaveUserName($workflow_id, $user->name) && Workflow_Permission::doesWorkflowHavePermission($workflow_id, "canTranscribe")) {
        $roiMetadata_record = AP_ROI::getroiMetadata_record($roi_pid);
        $roiURL = $roiMetadata_record['roiURL'];
        if ($height > $roiMetadata_record['h'] / $roiMetadata_record['w'] * $width) {
            $roi_image_url = scaleDjatokaURL($roiURL, $width, '0');
            //$roi_image_url = getDjatokaURL($roiMetadata_record['sourceURL'], 'getRegion', '100', $roiMetadata_record['y'], $roiMetadata_record['x'], $roiMetadata_record['h'], $roiMetadata_record['w'], $width, '0');
            $returnJSON['image_html'] = "<img class='transcribe_roi_image' src='{$roi_image_url}' />";
        } else {
            $roi_image_url = scaleDjatokaURL($roiURL, '0', $height);
            //$roi_image_url = getDjatokaURL($roiMetadata_record['sourceURL'], 'getRegion', '100', $roiMetadata_record['y'], $roiMetadata_record['x'], $roiMetadata_record['h'], $roiMetadata_record['w'], '0', $height);
            $returnJSON['image_html'] = "<img class='transcribe_roi_image' src='{$roi_image_url}' />";
        }
        $roi_obj = new roiHandler($roi_pid);
        $returnJSON['gocr'] = "";
        $returnJSON['ocrad'] = "";
        $returnJSON['ocropus'] = "";
        $returnJSON['text'] = "";
        if ($roi_obj->ifExist("GOCR")) {
            $returnJSON['gocr'] = $roi_obj->getDatastream("GOCR");
        }
        if ($roi_obj->ifExist("ocrad")) {
            $returnJSON['ocrad'] = $roi_obj->getDatastream("ocrad");
        }
        if ($roi_obj->ifExist("OCRopus")) {
            $returnJSON['ocropus'] = $roi_obj->getDatastream("OCRopus");
        }
        if ($roi_obj->ifExist("Text")) {
            $returnJSON['text'] = $roi_obj->getDatastream("Text");
        }
    } else {
        echo "Sorry! You do not have permission for this operation";
    }
    echo json_encode($returnJSON);
}
Exemplo n.º 4
0
function specimenMetadata_details_content($roi_pid = null)
{
    global $base_url;
    $fedora_base_url = variable_get("fedora_base_url", "http://localhost:8080/fedora");
    $html = '';
    $html .= '<div id="specimenMetadata_details_content">' . "\n";
    if ($roi_pid != null && $roi_pid != "0") {
        $roi = new AP_ROI();
        $image_pid = $roi->get_image_pid($roi_pid);
        $sp_pid = AP_Image::get_specimen_pid($image_pid);
        $roiMetadata_record = $roi->getroiMetadata_record($roi_pid);
        $roiURL = $roiMetadata_record['roiURL'];
        $djatoka_url = scaleDjatokaURL($roiURL, '300', '0');
        $html .= "<h3>Details: {$roi_pid}</h3>";
        $html .= "<table><tr><td valign='top' width='300'>";
        $html .= "<img src='{$djatoka_url}'/></td>";
        $html .= "<td>Specimen: {$sp_pid}<br/>Image: {$image_pid}<br/>ROI: {$roi_pid}<br/>Datastream: specimenMetadata<br/><br/>";
        $text = shell_exec("curl -H - XGET {$fedora_base_url}/get/{$roi_pid}/specimenMetadata");
        $check = strpos($text, "404 Not Found");
        if ($check === FALSE) {
            $specimenMetadata_xml_url = $server_base . '/drupal/modules/apiary_project/workflow/include/specimenMetadata_xml.php?pid=' . $roi_pid;
            $html .= '<textarea style="width:500px; height:200px">' . $text . '</textarea></td>';
            $html .= "</tr></table>";
        } else {
            $html .= "No specimenMetadata found";
        }
    } else {
    }
    $html .= '</div><!-- specimenMetadata_details_content -->' . "\n";
    echo $html;
}