Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAGDSTAE

MAGDSTAE.m

Go to the documentation of this file.
  1. MAGDSTAE ;WOIFO/PMK - Q/R Retrieve of DICOM images from PACS to VistA ; Jan 04, 2021@11:56:22
  1. ;;3.0;IMAGING;**231**;5-May-2007;Build 9
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. ; Third Step - Get missing series from PACS.
  1. ;
  1. ; VistA appears to be missing one or more series. Get them from the PACS.
  1. ;
  1. ; Perform the following steps to get all the missing series:
  1. ; a. Issue a PACS Study Root Series Level query (C-FIND) using the Study
  1. ; Instance UID (0020,000D) as the key. Request the following return
  1. ; data attributes:
  1. ; i. Series Instance UID (0020,000E)
  1. ; ii. Number of Series Related Instances (0020,1209)
  1. ; b. Compare the PACS retrieved Series Instance UIDs against those on VistA.
  1. ; For each missing Series Instance UID, do the following four steps:
  1. ; i. Use the Study Instance UID (0020,000D) and PACS retrieved Series
  1. ; Instance UID (0020,000E) to issue a Series Level retrieve (C-MOVE)
  1. ; to copy all the series' DICOM objects from the PACS to VistA.
  1. ; ii. Use the Study Instance UID (0020,000D) and PACS retrieved Series
  1. ; Instance UID (0020,000E) to issue an Image Level query (C-FIND)
  1. ; to obtain all the series' SOP Instance UIDs (0008,0018).
  1. ; iii. Add the retrieved Series Instance UID (0020,000E) and the series'
  1. ; SOP Instance UIDs (0008,0018) to the hierarchy mentioned above.
  1. ; iv. Update the study's SOP Instance count for VistA.
  1. ; get the series uid(s) for this study
  1. ;
  1. ; Note: PACS STUDYUID is a multiple, since PACS may have more than on Study UID per study.
  1. ; SERIES is called for each PACSSERIESUID for the study.
  1. ;
  1. SERIES(PACSSERIESUID) ; retrieve the series
  1. N I,NSERIESRI,PACSSTUDYUID,RETURN
  1. N SOPUID ;----- sop instance uid
  1. S RETURN=0
  1. ; get all of the series sop instances and send them to VistA
  1. S NSERIESRI=^TMP("MAG",$J,"UIDS","PACS SERIES UID",PACSSERIESUID,"IMAGE COUNT")
  1. I NSERIESRI>1 D
  1. . D QRSTATUS^MAGDSTAA("Retrieving a series with "_NSERIESRI_" images from PACS")
  1. . Q
  1. E D
  1. . D QRSTATUS^MAGDSTAA("Retrieving a series with one image from PACS")
  1. . Q
  1. S PACSSTUDYUID=$O(^TMP("MAG",$J,"UIDS","PACS SERIES UID",PACSSERIESUID,"STUDY UID",""))
  1. I PACSSTUDYUID="" Q ; there should always be a single Study UID for each Series UID
  1. D STTINC^MAGDSTAA("PACS SERIES LEVEL RETRIEVES",1)
  1. D STTINC^MAGDSTAA("PACS IMAGES RETRIEVED",NSERIESRI)
  1. D GETIMAGE(PACSSTUDYUID,SERIESUID) ; get one series of images
  1. Q
  1. ;
  1. GETIMAGE(PACSSTUDYUID,SERIESUID) ; retrieve one series SOP instances
  1. N I,SOPUID
  1. K ^TMP("MAG",$J,"Q/R QUERY")
  1. S ^TMP("MAG",$J,"Q/R QUERY",QRSTACK,"STUDY INSTANCE UID(0001)")=PACSSTUDYUID
  1. S ^TMP("MAG",$J,"Q/R QUERY",QRSTACK,"SERIES INSTANCE UID(0001)")=PACSSERIESUID
  1. S ^TMP("MAG",$J,"Q/R QUERY",QRSTACK,"QUERY USER APPLICATION")=$$QRSCP^MAGDSTA8
  1. S ^TMP("MAG",$J,"Q/R QUERY",QRSTACK,"RETRIEVE LEVEL")="SERIES"
  1. S ^TMP("MAG",$J,"Q/R QUERY",QRSTACK,"ROOT")="STUDY"
  1. D SOPUIDR^MAGDSTV1 ; C-MOVE
  1. Q