@@ -199,7 +199,7 @@ function start($args)
199
199
* Check DICOM server status
200
200
* @param storescp_cmd (Optional) The command to run storescp
201
201
* @param dcmqrscp_cmd (Optional) The command to run dcmqrscp
202
- * @return
202
+ * @return array('status' => string)
203
203
*/
204
204
function status ($ args )
205
205
{
@@ -353,9 +353,9 @@ function stop($args)
353
353
}
354
354
355
355
/**
356
- * Register dicom image files from a revision
356
+ * Register DICOM images from a revision to let them be available for DICOM query/retrieve services.
357
357
* @param item the id of the item to be registered
358
- * @return the id of the revision
358
+ * @return the revision dao (latest revision of the item) that was registered
359
359
*/
360
360
function register ($ args )
361
361
{
@@ -377,7 +377,39 @@ function register($args)
377
377
378
378
$ dicomComponent = MidasLoader::loadComponent ('Server ' , 'dicomserver ' );
379
379
$ dicomComponent ->register ($ revisionDao );
380
- return json_encode ($ revisionDao );
380
+ return $ revisionDao ->toArray ();
381
+ }
382
+
383
+ /**
384
+ * Check if the DICOM images in the item was registered and can be accessed by DICOM query/retrieve services.
385
+ * @param item the id of the item to be checked
386
+ * @return array('status' => bool)
387
+ */
388
+ function registrationStatus ($ args )
389
+ {
390
+ $ this ->_validateParams ($ args , array ('item ' ));
391
+
392
+ $ itemModel = MidasLoader::loadModel ("Item " );
393
+ $ authComponent = MidasLoader::loadComponent ('Authentication ' , 'api ' );
394
+ $ itemDao = $ itemModel ->load ($ args ['item ' ]);
395
+ $ userDao = $ authComponent ->getUser ($ args ,
396
+ Zend_Registry::get ('userSession ' )->Dao );
397
+ if (!$ itemModel ->policyCheck ($ itemDao , $ userDao , MIDAS_POLICY_WRITE ))
398
+ {
399
+ throw new Exception ('You didn \'t log in or you don \'t have the write ' .
400
+ 'permission for the given item. ' , MIDAS_INVALID_POLICY );
401
+ }
402
+
403
+ $ modelLoad = new MIDAS_ModelLoader ();
404
+ $ registrationModel = $ modelLoad ->loadModel ('Registration ' , 'dicomserver ' );
405
+ if (!$ registrationModel ->checkByItemId ($ args ['item ' ]))
406
+ {
407
+ return array ('status ' => false );
408
+ }
409
+ else
410
+ {
411
+ return array ('status ' => true );
412
+ }
381
413
}
382
414
}
383
415
0 commit comments