MAGDIR8 ;WOIFO/PMK - Read a DICOM image file ; 21 Apr 2011 2:47 PM
;;3.0;IMAGING;**11,51,54,138**;Mar 19, 2002;Build 5380;Sep 03, 2013
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
; M2MB server
;
; This routine is invoked by the M2M Broker RPC to process an image.
; It extracts each item from the REQUEST list and transfers control
; to the appropriate routine to process it. These routines, in turn,
; add items to the RESULT list for processing back on the gateway.
;
ENTRY(RESULT,REQUEST) ; RPC = MAG DICOM IMAGE PROCESSING
N ARGS ; ---- argument string of the REQUEST item
N DATETIME ;- fileman date/time of the study
N DCMPID ;--- DICOM patient id
N DFN ;------ VistA's internal patient identifier
N ERRCODE ;-- code for an error, if encountered
N IREQUEST ;- pointer to item in REQUEST array
N MSG ; ----- error message array
N OPCODE ;--- operation code of the REQUEST item
N RETURN ;--- intermediate return code
;
; pass the request list and determine what has to be done
F IREQUEST=2:1:$G(REQUEST(1)) D
. S OPCODE=$P(REQUEST(IREQUEST),"|")
. S ARGS=$P(REQUEST(IREQUEST),"|",2,999)
. I OPCODE="STORE1" D ENTRY^MAGDIR81 Q
. I OPCODE="ACQUIRED" D ACQUIRED^MAGDIR82 Q
. I OPCODE="PROCESSED" D POSTPROC^MAGDIR82 Q
. I OPCODE="CORRECT" D ENTRY^MAGDIR83 Q
. I OPCODE="PATIENT SAFETY" D ENTRY^MAGDIR84 Q
. I OPCODE="ROLLBACK" D ENTRY^MAGDIR85 Q
. I OPCODE="CRASH" D Q
. . S I=1/0 ; generate an error on the server to test error trapping
. . Q
. Q
Q
;
ERROR(OPCODE,ERRCODE,MSG,ROUTINE) ; build the RESULT array for the error
; this must be called after ^MAGDIRVE is invoked to put the message
; into the RESULT array - otherwise the message will be lost
N I,OK,X
S X=ERRCODE_"|"_$G(MSG("TITLE"))_"|"_ROUTINE_"|"_$G(MSG("CRITICAL"))
D RESULT^MAGDIR8(OPCODE,X)
S OK=0,I="" F S I=$O(MSG(I)) Q:'I D
. I MSG(I)?1"Problem detected by routine".E D
. . ; add error code to the message
. . S MSG(I)=MSG(I)_" Error Code: """_ERRCODE_""""
. . Q
. S OK=1 D RESULT^MAGDIR8("MSG","|"_MSG(I))
. Q
D:'OK RESULT^MAGDIR8("MSG","|Error Code: """_ERRCODE_""" (no further information is available)")
S $P(RESULT(RESULT(1)),"|",2)="END"
Q
;
RESULT(OPCODE,ARGS) ; add an item to the RESULT list
S RESULT(1)=$G(RESULT(1),1)+1 ; first element in array is counter
S RESULT(RESULT(1))=OPCODE_"|"_ARGS
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGDIR8 3438 printed Dec 13, 2024@02:00:20 Page 2
MAGDIR8 ;WOIFO/PMK - Read a DICOM image file ; 21 Apr 2011 2:47 PM
+1 ;;3.0;IMAGING;**11,51,54,138**;Mar 19, 2002;Build 5380;Sep 03, 2013
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ; M2MB server
+19 ;
+20 ; This routine is invoked by the M2M Broker RPC to process an image.
+21 ; It extracts each item from the REQUEST list and transfers control
+22 ; to the appropriate routine to process it. These routines, in turn,
+23 ; add items to the RESULT list for processing back on the gateway.
+24 ;
ENTRY(RESULT,REQUEST) ; RPC = MAG DICOM IMAGE PROCESSING
+1 ; ---- argument string of the REQUEST item
NEW ARGS
+2 ;- fileman date/time of the study
NEW DATETIME
+3 ;--- DICOM patient id
NEW DCMPID
+4 ;------ VistA's internal patient identifier
NEW DFN
+5 ;-- code for an error, if encountered
NEW ERRCODE
+6 ;- pointer to item in REQUEST array
NEW IREQUEST
+7 ; ----- error message array
NEW MSG
+8 ;--- operation code of the REQUEST item
NEW OPCODE
+9 ;--- intermediate return code
NEW RETURN
+10 ;
+11 ; pass the request list and determine what has to be done
+12 FOR IREQUEST=2:1:$GET(REQUEST(1))
Begin DoDot:1
+13 SET OPCODE=$PIECE(REQUEST(IREQUEST),"|")
+14 SET ARGS=$PIECE(REQUEST(IREQUEST),"|",2,999)
+15 IF OPCODE="STORE1"
DO ENTRY^MAGDIR81
QUIT
+16 IF OPCODE="ACQUIRED"
DO ACQUIRED^MAGDIR82
QUIT
+17 IF OPCODE="PROCESSED"
DO POSTPROC^MAGDIR82
QUIT
+18 IF OPCODE="CORRECT"
DO ENTRY^MAGDIR83
QUIT
+19 IF OPCODE="PATIENT SAFETY"
DO ENTRY^MAGDIR84
QUIT
+20 IF OPCODE="ROLLBACK"
DO ENTRY^MAGDIR85
QUIT
+21 IF OPCODE="CRASH"
Begin DoDot:2
+22 ; generate an error on the server to test error trapping
SET I=1/0
+23 QUIT
End DoDot:2
QUIT
+24 QUIT
End DoDot:1
+25 QUIT
+26 ;
ERROR(OPCODE,ERRCODE,MSG,ROUTINE) ; build the RESULT array for the error
+1 ; this must be called after ^MAGDIRVE is invoked to put the message
+2 ; into the RESULT array - otherwise the message will be lost
+3 NEW I,OK,X
+4 SET X=ERRCODE_"|"_$GET(MSG("TITLE"))_"|"_ROUTINE_"|"_$GET(MSG("CRITICAL"))
+5 DO RESULT^MAGDIR8(OPCODE,X)
+6 SET OK=0
SET I=""
FOR
SET I=$ORDER(MSG(I))
if 'I
QUIT
Begin DoDot:1
+7 IF MSG(I)?1"Problem detected by routine".E
Begin DoDot:2
+8 ; add error code to the message
+9 SET MSG(I)=MSG(I)_" Error Code: """_ERRCODE_""""
+10 QUIT
End DoDot:2
+11 SET OK=1
DO RESULT^MAGDIR8("MSG","|"_MSG(I))
+12 QUIT
End DoDot:1
+13 if 'OK
DO RESULT^MAGDIR8("MSG","|Error Code: """_ERRCODE_""" (no further information is available)")
+14 SET $PIECE(RESULT(RESULT(1)),"|",2)="END"
+15 QUIT
+16 ;
RESULT(OPCODE,ARGS) ; add an item to the RESULT list
+1 ; first element in array is counter
SET RESULT(1)=$GET(RESULT(1),1)+1
+2 SET RESULT(RESULT(1))=OPCODE_"|"_ARGS
+3 QUIT