local i_nConn,i_cTable,i_nOldArea,i_ErrMsg,i_ccchkf,i_ccchkv
DELETE FILE ("c:\dicom\dicom.ini")
this.X=FCREATE("c:\dicom\dicom.ini",0)
FPUTS(this.X,"# This file contains configuration information for the DICOM server")
FPUTS(this.X,"# Do not edit unless you know what you are doing")
FPUTS(this.X,"MicroPACS = sscscp")
FPUTS(this.X,"Edition = Personal")
FPUTS(this.X,"# Network configuration: server name and TCP/IP port#")
FPUTS(this.X,"MyACRNema = "+ALLTRIM(this.AE))
FPUTS(this.X,"TCPPort = "+ALLTRIM(this.PORT))
FPUTS(this.X,"# Reference to other files: known dicom servers; database layout; sops")
FPUTS(this.X,"ACRNemaMap = acrnema.map")
FPUTS(this.X,"kFactorFile = dicom.sql")
FPUTS(this.X,"SOPClassList = dgatesop.lst")
FPUTS(this.X,"# Host(ignored), name, username and password for ODBC data source")
FPUTS(this.X,"SQLHost = ")
FPUTS(this.X,"SQLServer = ")
FPUTS(this.X,"Username = ")
FPUTS(this.X,"Password = ")
FPUTS(this.X,"DoubleBackSlashToDB = 0")
FPUTS(this.X,"# Configure database")
FPUTS(this.X,"TruncateFieldNames = 10")
FPUTS(this.X,"MaxFieldLength = 254")
FPUTS(this.X,"MaxFileNameLength = 255")
FPUTS(this.X,"FixPhilips = 0")
FPUTS(this.X,"FixKodak = 0")
FPUTS(this.X,"KeepAlive = 0")
FPUTS(this.X,"LargeFileSizeKB = 1024")
FPUTS(this.X,"ZipTime = 05:")
FPUTS(this.X,"UIDPrefix = 1.2.826.0.1.3680043.2.135.730956.43877812")
FPUTS(this.X,"EnableReadAheadThread = 1")
FPUTS(this.X,"PatientQuerySortOrder = ")
FPUTS(this.X,"StudyQuerySortOrder =")
FPUTS(this.X,"SeriesQuerySortOrder =")
FPUTS(this.X,"ImageQuerySortOrder =")
FPUTS(this.X,"IndexDBF = 1")
FPUTS(this.X,"PackDBF = 0")
FPUTS(this.X,"LongQueryDBF = 1000")
FPUTS(this.X,"TCPIPTimeOut = 300")
FPUTS(this.X,"FailHoldOff = 60")
FPUTS(this.X,"RetryDelay = 100")
FPUTS(this.X,"QueueSize = 128")
FPUTS(this.X,"WorkListMode = 0")
FPUTS(this.X,"DebugLevel = 0")
FPUTS(this.X,"Prefetcher = 0")
FPUTS(this.X,"LRUSort =")
FPUTS(this.X,"AllowTruncate =")
FPUTS(this.X,"DecompressNon16BitsJpeg = 1")
FPUTS(this.X,"UseBuiltInDecompressor = 1")
FPUTS(this.X,"FileNameSyntax = 0")
FPUTS(this.X,"# Configuration of compression for incoming images and archival")
FPUTS(this.X,"DroppedFileCompression = un")
FPUTS(this.X,"IncomingCompression = un")
FPUTS(this.X,"ArchiveCompression = as")
FPUTS(this.X,"# Names of the database tables")
FPUTS(this.X,"PatientTableName = DICOMPatients")
FPUTS(this.X,"StudyTableName = DICOMStudies")
FPUTS(this.X,"SeriesTableName = DICOMSeries")
FPUTS(this.X,"ImageTableName = DICOMImages")
FPUTS(this.X,"DMarkTableName = DICOMAccessUpdates")
FPUTS(this.X,"RegisteredMOPDeviceTable = RegisteredMOPIDs")
FPUTS(this.X,"UIDToMOPIDTable = UIDToMOPID")
FPUTS(this.X,"UIDToCDRIDTable = UIDToCDRID")
FPUTS(this.X,"# Banner and host for debug information")
FPUTS(this.X,"PACSName = CONQUESTSRV1")
FPUTS(this.X,"OperatorConsole = 127.0.0.1")
FPUTS(this.X,"# Configuration of disk(s) to store images")
FPUTS(this.X,"MAGDeviceThreshhold = 0")
FPUTS(this.X,"MAGDevices = 1")
FPUTS(this.X,"MAGDevice0 = "+ALLTRIM(this.PATH_DICOM)+"\")
FPUTS(this.X,"NightlyCleanThreshhold = 0")
FPUTS(this.X,"ImportConverters = 5")
FPUTS(this.X,"ImportConverter0 = ifnotequal "+ '"'+"%m"+'","'+"SR"+'"'+";save to "+ALLTRIM(this.PATH_DICOM)+"\temp.dcm")
FPUTS(this.X,"ImportConverter1 = ifequal "+ '"'+"%m"+'","'+"SR"+'"'+";save to "+ALLTRIM(this.PATH_DICOM)+"\misure.dcm")
FPUTS(this.X,"ImportConverter2 = ifnotequal "+ '"'+"%m"+'","'+"SR"+'"'+";process with dgate.exe "+'"'+"--convert_to_jpg:"+ALLTRIM(this.PATH_DICOM)+"\temp.dcm,1024,"+ALLTRIM(this.PATH_DICOM)+"\"+"%V0020,0013.jpg,//0")
FPUTS(this.X,"ImportConverter3 = ifequal "+ '"'+"%m"+'","'+"SR"+'"'+";process with C:\DICOM\dsr2xml.exe "+ALLTRIM(this.PATH_DICOM)+"\temp.dcm "+ALLTRIM(this.PATH_DICOM)+"\misure.xml")
FPUTS(this.X,"ImportConverter4 = destroy")
RUN /N2 c:\dicom\DGATE.EXE --read_ini: