Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update API summary header and qc too grep more info #4077

Merged
27 changes: 25 additions & 2 deletions docs/API/LorisRESTAPI_v0.0.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,23 @@ Returns file level QC information. It will return a JSON object of the form:
"File" : $Filename
},
"QC" : "Pass|Fail",
"Selected" : boolean
"Selected" : boolean,
"Caveats" : [
{
"Severity" : $severity,
"Header" : $header,
"Value" : $headerValue,
"ValidRange" : $headerValidRange,
"ValidRegex" : $headerValidRegex
},
{
"Severity" : $severity,
"Header" : $header,
"Value" : $headerValue,
"ValidRange" : $headerValidRange,
"ValidRegex" : $headerValidRegex
}
]
}
```

Expand Down Expand Up @@ -668,7 +684,7 @@ will return a JSON object of the form:
"Description" : {
"SeriesName" : "",
"SeriesDescription" : ""
}
},
"Dimensions" : {
"XSpace" : {
"Length" : "",
Expand All @@ -686,6 +702,13 @@ will return a JSON object of the form:
"Length" : "",
"StepSize" : ""
}
},
"ScannerInfo" : {
"Manufacturer" : $scannerManufacturer,
"Model" : $scannerModel,
"SoftwareVersion" : $scannerSoftwareVersion,
"SerialNumber" : $scannerSerialNumber,
"FieldStrength" : $scannerFieldStrength
}
}
```
Expand Down
14 changes: 7 additions & 7 deletions htdocs/api/v0.0.2/candidates/visits/images/qc/QC.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public function handleGET()
$factory = \NDB_Factory::singleton();
$DB = $factory->Database();
$QCStatus = $DB->pselectRow(
"SELECT QCStatus,
pf.Value as Selected FROM files f
LEFT JOIN files_qcstatus fqc ON (f.FileID=fqc.FileID)
LEFT JOIN parameter_file pf ON (f.FileID=pf.FileID)
LEFT JOIN parameter_type pt
ON (pf.ParameterTypeID=pt.ParameterTypeID AND pt.Name='Selected')
WHERE f.File LIKE CONCAT('%', :FName)",
"SELECT QCStatus, Selected
FROM files_qcstatus
WHERE FileID in (
SELECT FileID
FROM files
WHERE File LIKE CONCAT('%', :FName)
)",
array('FName' => $this->Filename)
);
$this->JSON = [
Expand Down
99 changes: 56 additions & 43 deletions htdocs/api/v0.0.3-dev/candidates/visits/images/headers/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,54 +62,67 @@ public function __construct($method, $CandID, $VisitLabel, $Filename)
*/
public function handleGET()
{
$TE = $this->getHeader('acquisition:echo_time');
$TR = $this->getHeader('acquisition:repetition_time');
$TI = $this->getHeader('acquisition:inversion_time');
$ST = $this->getHeader('acquisition:slice_thickness');
$te = $this->getHeader('acquisition:echo_time');
$tr = $this->getHeader('acquisition:repetition_time');
$ti = $this->getHeader('acquisition:inversion_time');
$st = $this->getHeader('acquisition:slice_thickness');

$SeriesName = $this->getHeader("acquisition:protocol");
$SeriesDescription = $this->getHeader("acquisition:series_description");
$seriesName = $this->getHeader("acquisition:protocol");
$seriesDescription = $this->getHeader("acquisition:series_description");

$XSpace = [
"Length" => $this->getHeader("xspace:length"),
"StepSize" => $this->getHeader("xspace:step"),
];
$YSpace = [
"Length" => $this->getHeader("yspace:length"),
"StepSize" => $this->getHeader("yspace:step"),
];
$ZSpace = [
"Length" => $this->getHeader("zspace:length"),
"StepSize" => $this->getHeader("zspace:step"),
];
$TimeD = [
"Length" => $this->getHeader("time:length"),
"StepSize" => $this->getHeader("time:step"),
];
$this->JSON = [
'Meta' => [
$xspace = array(
"Length" => $this->getHeader("xspace:length"),
"StepSize" => $this->getHeader("xspace:step"),
);
$yspace = array(
"Length" => $this->getHeader("yspace:length"),
"StepSize" => $this->getHeader("yspace:step"),
);
$zspace = array(
"Length" => $this->getHeader("zspace:length"),
"StepSize" => $this->getHeader("zspace:step"),
);
$timeD = array(
"Length" => $this->getHeader("time:length"),
"StepSize" => $this->getHeader("time:step"),
);

$manufacturer = $this->getHeader("study:manufacturer");
$model = $this->getHeader("study:device_model");
$softwareVersion = $this->getHeader("study:software_version");
$serialNumber = $this->getHeader("study:serial_no");
$fieldStrength = $this->getHeader("study:field_value");

$this->JSON = array(
'Meta' => array(
'CandID' => $this->CandID,
'Visit' => $this->VisitLabel,
'Filename' => $this->Filename,
],
'Physical' => [
"TE" => $TE,
"TR" => $TR,
"TI" => $TI,
"SliceThickness" => $ST,
],
'Description' => [
"SeriesName" => $SeriesName,
"SeriesDescription" => $SeriesDescription,
],
'Dimensions' => [
"XSpace" => $XSpace,
"YSpace" => $YSpace,
"ZSpace" => $ZSpace,
"TimeDimension" => $TimeD,
],

];
),
'Physical' => array(
"TE" => $te,
"TR" => $tr,
"TI" => $ti,
"SliceThickness" => $st,
),
'Description' => array(
"SeriesName" => $seriesName,
"SeriesDescription" => $seriesDescription,
),
'Dimensions' => array(
"XSpace" => $xspace,
"YSpace" => $yspace,
"ZSpace" => $zspace,
"TimeDimension" => $timeD,
),
'ScannerInfo' => array(
"Manufacturer" => $manufacturer,
"Model" => $model,
"SoftwareVersion" => $softwareVersion,
"SerialNumber" => $serialNumber,
"FieldStrength" => $fieldStrength,
),
);
}

/**
Expand Down
43 changes: 32 additions & 11 deletions htdocs/api/v0.0.3-dev/candidates/visits/images/qc/QC.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,45 @@ public function handleGET()
$factory = \NDB_Factory::singleton();
$DB = $factory->Database();
$QCStatus = $DB->pselectRow(
"SELECT QCStatus,
pf.Value as Selected FROM files f
LEFT JOIN files_qcstatus fqc ON (f.FileID=fqc.FileID)
LEFT JOIN parameter_file pf ON (f.FileID=pf.FileID)
LEFT JOIN parameter_type pt
ON (pf.ParameterTypeID=pt.ParameterTypeID AND pt.Name='Selected')
WHERE f.File LIKE CONCAT('%', :FName)",
"SELECT QCStatus, Selected
FROM files_qcstatus
WHERE FileID in (
SELECT FileID
FROM files
WHERE File LIKE CONCAT('%', :FName)
)",
array('FName' => $this->Filename)
);
$this->JSON = [
'Meta' => [
$caveats = $this->getImageCaveats();
$this->JSON = array(
'Meta' => array(
'CandID' => $this->CandID,
'Visit' => $this->VisitLabel,
'File' => $this->Filename,
],
),
'QC' => $QCStatus['QCStatus'],
'Selected' => $QCStatus['Selected'],
];
'Caveats' => $caveats,
);
}

/**
* Gets the list of Caveats for the file.
*
* @return array A list of caveats for the file
*/
function getImageCaveats(): array
{
$factory = \NDB_Factory::singleton();
$DB = $factory->Database();
$rows = $DB->pselect(
"SELECT Severity, Header, Value, ValidRange, ValidRegex
FROM files f
LEFT JOIN mri_violations_log mvl ON (f.SeriesUID=mvl.SeriesUID)
WHERE f.File LIKE CONCAT('%', :FName)",
array('FName' => $this->Filename)
);
return $rows;
}

/**
Expand Down