Tutorial: Connecting the Sample Database to the LEAD HTML5 Medical Viewer

Step 1: Configure the HTML5 Medical Viewer to work with the shipping database schema

This should already be configured, as it is part of the Configure the LEAD Storage Server with the shipping database schema step in the Changing the LEAD Medical Storage Server to Use a Different Database Schema tutorial. 

If you have not already done this, you must restore the globalPacs.config file to reference the shipping database:

Step 2: Modify GlobalPacs.config to use the tutorial custom database

This should already be configured if you have finished the Changing the LEAD Medical Storage Server to Use a Different Database Schema tutorial.

If you have not already done this, follow Step 4: Modify GlobalPacs.config to use the New Database of the Changing the LEAD Medical Storage Server to Use a Different Database Schema tutorial.

Step 3: Modify the web.config to use the storage catalog and the DataSet Schema

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
  <configSections> 
    <section name="xmlStorageCatalogSettings" type="Leadtools.Medical.Storage.DataAccessLayer.XmlStorageCatalogSettings, Leadtools.Medical.Storage.DataAccessLayer" /> 
  </configSections> 
  <xmlStorageCatalogSettings catalogPath="C:\LEADTOOLS 19\Bin\Dotnet4\Win32\MyCatalog.xml"/> 
   <system.web> 
      <compilation debug="true" /> 
      <authentication mode="None"/> 
      <httpRuntime maxRequestLength="2097151" /> 
      <hostingEnvironment shadowCopyBinAssemblies="false"/> 
      <pages compilationMode="Never"/> 
   </system.web> 
   <!-- When deploying the service library project, the content of the config file must be added to the host's  
  app.config file. System.Configuration does not support config files for libraries. --> 
   <system.serviceModel> 
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> 
 
      <services> 
         <service name="Leadtools.Medical.WebViewer.Wcf.StoreService" behaviorConfiguration="WebViewerServiceBehavior"> 
            <endpoint address="" binding="webHttpBinding" contract="Leadtools.Medical.WebViewer.ServiceContracts.IStoreService" behaviorConfiguration="WebViewerServiceBehavior" bindingConfiguration="HandleLargeData"> 
            </endpoint> 
         </service> 
 
         <service name="Leadtools.Medical.WebViewer.Wcf.ObjectQueryService" behaviorConfiguration="WebViewerServiceBehavior"> 
            <endpoint address="" binding="webHttpBinding" contract="Leadtools.Medical.WebViewer.ServiceContracts.IObjectQueryService" behaviorConfiguration="WebViewerServiceBehavior"> 
            </endpoint> 
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
         </service> 
         <service name="Leadtools.Medical.WebViewer.Wcf.ObjectRetrieveService" behaviorConfiguration="WebViewerServiceBehavior"> 
            <endpoint address="" binding="webHttpBinding" contract="Leadtools.Medical.WebViewer.ServiceContracts.IObjectRetrieveService" behaviorConfiguration="WebViewerServiceBehavior"> 
            </endpoint> 
         </service> 
         <service name="Leadtools.Medical.WebViewer.Wcf.PacsQueryService" behaviorConfiguration="WebViewerServiceBehavior"> 
            <endpoint address="" binding="webHttpBinding" contract="Leadtools.Medical.WebViewer.ServiceContracts.IPACSQueryService" behaviorConfiguration="WebViewerServiceBehavior"> 
            </endpoint> 
            <!-- Metadata Endpoints --> 
            <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
            <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> 
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
         </service> 
         <service name="Leadtools.Medical.WebViewer.Wcf.PACSRetrieveService" behaviorConfiguration="WebViewerServiceBehavior"> 
            <endpoint address="" binding="webHttpBinding" contract="Leadtools.Medical.WebViewer.ServiceContracts.IPACSRetrieveService" behaviorConfiguration="WebViewerServiceBehavior"> 
            </endpoint> 
         </service> 
         <service name="Leadtools.Medical.WebViewer.Wcf.AuthenticationService" behaviorConfiguration="WebViewerServiceBehavior"> 
            <endpoint address="" binding="webHttpBinding" contract="Leadtools.Medical.WebViewer.ServiceContracts.IAuthenticationService" behaviorConfiguration="WebViewerServiceBehavior"> 
            </endpoint> 
         </service> 
         <service name="Leadtools.Medical.WebViewer.Wcf.PatientAccessRightsService" behaviorConfiguration="WebViewerServiceBehavior"> 
            <endpoint address="" binding="webHttpBinding" contract="Leadtools.Medical.WebViewer.ServiceContracts.IPatientAccessRightsService" behaviorConfiguration="WebViewerServiceBehavior"> 
            </endpoint> 
         </service> 
         <service name="Leadtools.Medical.WebViewer.Wcf.AnnotationsService" behaviorConfiguration="WebViewerServiceBehavior"> 
            <endpoint address="" binding="webHttpBinding" contract="Leadtools.Medical.WebViewer.ServiceContracts.IAnnotationsService" behaviorConfiguration="WebViewerServiceBehavior" bindingConfiguration="HandleLargeData"> 
            </endpoint> 
         </service> 
      </services> 
      <extensions> 
         <behaviorExtensions> 
            <add name="jsonWebHttp" type="Leadtools.Dicom.Services.ErrorHandler.JsonErrorWebHttpBehaviorElement, Leadtools.Medical.WebViewer.WCF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> 
         </behaviorExtensions> 
      </extensions> 
      <bindings> 
         <webHttpBinding> 
            <binding name="HandleLargeData" maxReceivedMessageSize="2147483647"> 
                
               <readerQuotas maxDepth="2147483647" 
                  maxStringContentLength="2147483647" 
                  maxArrayLength="2147483647" 
                  maxBytesPerRead="2147483647" 
                  maxNameTableCharCount="2147483647" /> 
            </binding> 
         </webHttpBinding> 
      </bindings> 
      <behaviors> 
         <serviceBehaviors> 
            <behavior name="WebViewerServiceBehavior"> 
               <!-- To avoid disclosing metadata information,  
          set the value below to false and remove the metadata endpoint above before deployment --> 
               <serviceMetadata httpGetEnabled="True" /> 
               <!-- To receive exception details in faults for debugging purposes,  
          set the value below to true.  Set to false before deployment  
          to avoid disclosing exception information --> 
               <serviceDebug includeExceptionDetailInFaults="True" /> 
            </behavior> 
         </serviceBehaviors> 
         <endpointBehaviors> 
            <behavior name="WebViewerServiceBehavior"> 
               <webHttp /> 
               <jsonWebHttp /> 
            </behavior> 
         </endpointBehaviors> 
      </behaviors> 
   </system.serviceModel> 
   <connectionStrings> 
   </connectionStrings> 
   <appSettings> 
      <add key="license" /> 
      <add key="key" /> 
      <add key="ClientAe" value="L18_CLIENT32" /> 
      <add key="ClientIP" value="192.168.0.181" /> 
      <add key="ClientPort" value="1000" /> 
      <add key="ServerAe" value="L18_PACS_SCP32" /> 
      <add key="ServerIP" value="192.168.0.181" /> 
      <add key="ServerPort" value="504" /> 
      <add key="globalConfigPath" value="C:\LLEADTOOLS 19\Bin\Dotnet4\Win32\GlobalPacs.config" /> 
      <add key="storageServerServicePath" value="c:\LEADTOOLS 19\bin\dotnet4\win32\L19_PACS_SCP32\" /> 
     <add key="DataSetSchema" value="C:\LEADTOOLS 19\Bin\Dotnet4\Win32\MyDataSet.xsd"/> 
   </appSettings> 
</configuration> 

Step 4: Modify the Leadtools.Medical.WebViewer.WCF Assembly

Note that any code modifications that you make as part of this tutorial have already been included in the shipping version of the source code, wrapped in directives, as shown below:

#if TUTORIAL_CUSTOM_DATABASE  
// Begin of Tutorial Source Code Modifications 
// ... 
// ...  
// End of Tutorial Source Code Modifications 
#endif 

using My.Medical.Storage.DataAccessLayer; 
using My.Medical.Storage.DataAccessLayer.Entities; 

public static void RegisterInterfaces() 
      { 
         if (!DataAccessServiceLocator.IsRegistered<IPatientInfo>()) 
         { 
            DataAccessServiceLocator.Register<IPatientInfo>(new MyPatientInfo()); 
         } 
 
         if (!DataAccessServiceLocator.IsRegistered<IStudyInfo>()) 
         { 
            DataAccessServiceLocator.Register<IStudyInfo>(new MyStudyInfo()); 
         } 
 
         if (!DataAccessServiceLocator.IsRegistered<ISeriesInfo>()) 
         { 
            DataAccessServiceLocator.Register<ISeriesInfo>(new MySeriesInfo()); 
         } 
 
         if (!DataAccessServiceLocator.IsRegistered<IInstanceInfo>()) 
         { 
            DataAccessServiceLocator.Register<IInstanceInfo>(new MyInstanceInfo()); 
         } 
 
         if (!DataAccessServices.IsDataAccessServiceRegistered<IStorageDataAccessAgent>()) 
         { 
            System.Configuration.Configuration configuration = ServiceUtils.GetGlobalPacsConfig();      
            IStorageDataAccessAgent storageDataAccess = DataAccessFactory.GetInstance(new MyStorageDataAccessConfigurationView(configuration, ServiceUtils.ProductNameStorageServer, null)).CreateDataAccessAgent<IStorageDataAccessAgent>(); 
            DataAccessServices.RegisterDataAccessService<IStorageDataAccessAgent>(storageDataAccess); 
         } 
 
         RegisteredEntities.AddItem(RegisteredEntities.PatientEntityName, typeof(MyPatient)); 
         RegisteredEntities.AddItem(RegisteredEntities.StudyEntityName, typeof(MyStudy)); 
         RegisteredEntities.AddItem(RegisteredEntities.SeriesEntityName, typeof(MySeries)); 
         RegisteredEntities.AddItem(RegisteredEntities.InstanceEntityName, typeof(MyInstance)); 
      } 

   Build the project to generate the new Leadtools.Medical.WebViewer.WCF assembly. 

Step 5: Modify the Leadtools.Medical.WebViewer.Addins Assembly

public static void FillMatchingParameters(QueryOptions query, MatchingParameterList matchingList) 
    { 
       // if we have patient options then create a DB Patient object for matching and copy the values 
       if ( 
          (query.PatientsOptions != null) &&  
          (!string.IsNullOrEmpty(query.PatientsOptions.PatientID) || 
             !string.IsNullOrEmpty(query.PatientsOptions.PatientName)) 
          ) 
       { 
          MyPatient patient = new MyPatient(); 
 
          patient.PatientIdentification =  
                (!string.IsNullOrEmpty(query.PatientsOptions.PatientID)) ? query.PatientsOptions.PatientID : null; 
 
          if (!string.IsNullOrEmpty(query.PatientsOptions.PatientName)) 
          { 
                patient.PatientName = query.PatientsOptions.PatientName; 
          } 
 
          matchingList.Add(patient); 
       } 
 
       // if we have study options then create a DB study object for matching and copy the values 
       if ((query.StudiesOptions != null) && ( 
             !string.IsNullOrEmpty(query.StudiesOptions.AccessionNumber) || 
             !string.IsNullOrEmpty(query.StudiesOptions.ReferDoctorName) || 
             !string.IsNullOrEmpty(query.StudiesOptions.StudyDateStart) || 
             !string.IsNullOrEmpty(query.StudiesOptions.StudyDateEnd) || 
             !string.IsNullOrEmpty(query.StudiesOptions.StudyID) || 
             !string.IsNullOrEmpty(query.StudiesOptions.StudyInstanceUID) || 
             (query.StudiesOptions.ModalitiesInStudy != null &&  
                query.StudiesOptions.ModalitiesInStudy.Length > 0))) 
       { 
          MyStudy study = new MyStudy(); 
 
          study.StudyAccessionNumber =  
                (!string.IsNullOrEmpty(query.StudiesOptions.AccessionNumber)) ? query.StudiesOptions.AccessionNumber : null; 
          study.StudyStudyId =  
                (!string.IsNullOrEmpty(query.StudiesOptions.StudyID)) ? query.StudiesOptions.StudyID : null; 
          study.StudyStudyInstanceUID =  
                (!string.IsNullOrEmpty(query.StudiesOptions.StudyInstanceUID)) ? query.StudiesOptions.StudyInstanceUID : null; 
 
          if (!string.IsNullOrEmpty(query.StudiesOptions.ReferDoctorName)) 
          { 
                study.StudyReferringPhysiciansName = query.StudiesOptions.ReferDoctorName; 
          } 
 
          if (!string.IsNullOrEmpty(query.StudiesOptions.StudyDateStart) || !string.IsNullOrEmpty(query.StudiesOptions.StudyDateEnd)) 
          { 
                study.StudyStudyDate = new DateRange(); 
                AddInsUtils.FillDateRangeInfo(query.StudiesOptions.StudyDateStart, query.StudiesOptions.StudyDateEnd, study.StudyStudyDate); 
          } 
 
          matchingList.Add(study); 
 
          if (query.StudiesOptions.ModalitiesInStudy != null && query.StudiesOptions.ModalitiesInStudy.Length > 0) 
          { 
                MySeries series = new MySeries(); 
                series.SeriesModality = string.Join("\\", query.StudiesOptions.ModalitiesInStudy); 
                matchingList.Add(series); 
          } 
       } 
 
       // Series query options 
       if ((query.SeriesOptions != null) && ( 
             !string.IsNullOrEmpty(query.SeriesOptions.SeriesInstanceUID) || 
             !string.IsNullOrEmpty(query.SeriesOptions.SeriesNumber) || 
             (null != query.SeriesOptions.Modality))) 
       { 
          MySeries series = new MySeries(); 
          series.SeriesSeriesInstanceUID =  
                (!string.IsNullOrEmpty(query.SeriesOptions.SeriesInstanceUID)) ? query.SeriesOptions.SeriesInstanceUID : null; 
          series.SeriesSeriesNumber =  
                (!string.IsNullOrEmpty(query.SeriesOptions.SeriesNumber)) ? query.SeriesOptions.SeriesNumber : null; 
 
          if (!string.IsNullOrEmpty(query.SeriesOptions.Modality)) 
          { 
                series.SeriesModality = query.SeriesOptions.Modality; 
          } 
 
          matchingList.Add(series); 
       } 
 
       // Instance query options 
       if ((null != query.InstancesOptions) && ( 
             !string.IsNullOrEmpty(query.InstancesOptions.InstanceNumber) || 
             !string.IsNullOrEmpty(query.InstancesOptions.SOPInstanceUID))) 
       { 
          MyInstance instance = new MyInstance(); 
 
          instance.SOPInstanceUID =  
                (!string.IsNullOrEmpty(query.InstancesOptions.SOPInstanceUID)) ? query.InstancesOptions.SOPInstanceUID : null; 
 
          string sImageNumber =  
                (!string.IsNullOrEmpty(query.InstancesOptions.InstanceNumber)) ? query.InstancesOptions.InstanceNumber : null; 
 
          int nImageNumber = 0; 
          if (int.TryParse(sImageNumber, out nImageNumber)) 
          { 
                instance.ImageImageNumber = nImageNumber; 
          } 
 
          matchingList.Add(instance); 
       } 
    } 

public PresentationStateData[] FindPresentationState (string userName, string referencedSeries,  string userData) 
   { 
       return new PresentationStateData[0]; 
   } 

private DataSet FindPresentationInstance(string sopInstanceUID, out MatchingParameterCollection matchingCollection) 
{ 
   matchingCollection = new MatchingParameterCollection ( ) ; 
   MatchingParameterList matchingList = new MatchingParameterList ( ) ; 
 
 
   MySeries seriesEntity = new MySeries(); 
   MyInstance instanceEntity = new MyInstance ( sopInstanceUID ) ; 
   seriesEntity.SeriesModality = "PR" ; 
 
 
   matchingList.Add ( instanceEntity ) ; 
   matchingList.Add ( seriesEntity ) ; 
   matchingCollection.Add ( matchingList ) ; 
 
   return _storageAgent.QueryCompositeInstances ( matchingCollection ) ; 
} 

Step 6: Copy the modified assemblies to the Medical Viewer Service Bin folder

Step 7: Verify the HTML5 Medical Web Viewer Demo is using the Custom Database

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Imaging, Medical, and Document