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 18\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:\LEADTOOLS 18\Bin\Dotnet4\Win32\GlobalPacs.config" />

      <add key="storageServerServicePath" value="c:\leadtools 18\bin\dotnet4\win32\L18_PACS_SCP32\" />

     <add key="DataSetSchema" value="C:\LEADTOOLS 18\Bin\Dotnet4\Win32\MyDataSet.xsd"/>

   </appSettings>

</configuration>

 

 

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

Note 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

     #if TUTORIAL_CUSTOM_DATABASE

// Begin of Tutorial Source Code Modifications

// ...

// ...

// End of Tutorial Source Code Modifications

#endif

 

§         Start Visual Studio

§         Open the Leadtools.Medical.WebViewer.WCF project.

§         In solution explorer, right-click the References folder, and add a reference to your My.Medical.Storage.DataAccessLayer.dll.  You created this assembly in the Create the custom storage data access layer, and configuration assemblies step in the Changing the LEAD Medical Storage Server to Use a Different Database Schema tutorial.

§         Modify Utils.cs

o        The default location is C:\LEADTOOLS 18\Examples\PACSFramework\MedicalWebViewer\Leadtools.Medical.WebViewer.WCF\Helper\Utils.cs

o        Add the following using statements to the top of Utils.cs

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

§         Start Visual Studio

§         Open the Leadtools.Medical.WebViewer.Addins project.

§         In solution explorer, right-click the References folder, and add a reference to your My.Medical.Storage.DataAccessLayer.dll.  You created this assembly in the Create the custom storage data access layer, and configuration assemblies step in the Changing the LEAD Medical Storage Server to Use a Different Database Schema tutorial.

§         Modify AddInsUtils.cs

o        The default location is C:\LEADTOOLS 18\Examples\PACSFramework\MedicalWebViewer\Leadtools.Medical.WebViewer.Addins\Common\AddInsUtils.cs

o        Add the following using statements to the top of AddInsUtils.cs

using My.Medical.Storage.DataAccessLayer.Entities;

  • Modify the FillMatchingParameters()  method so that it does the following (for more information, see the FillMatchingParameters Method topic).

       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);

           }

       }

 

o        Modify DatabaseQueryAddin.cs

§         The default location is C:\LEADTOOLS 18\Examples\PACSFramework\MedicalWebViewer\Leadtools.Medical.WebViewer.Addins\DatabaseQueryAddin\DatabaseQueryAddin.cs

§         The tutorial database schema does not store presentation state information, so for the tutorial modify the FindPresentationState() method to always return an empty list.

public PresentationStateData[] FindPresentationState (string userName, string referencedSeries,  string userData)

{

    return new PresentationStateData[0];

}

 

o        Modify StoreAddin.cs

o        The default location is C:\LEADTOOLS 18\Examples\PACSFramework\MedicalWebViewer\Leadtools.Medical.WebViewer.Addins\StoreAddin\StoreAddin.cs

o        Add the following using statements to the top of StoreAddin.cs

using My.Medical.Storage.DataAccessLayer.Entities;

 

  • While the tutorial database schema does not store presentation state information, it does store and delete presentation state instances. For the tutorial, the FindPresentationInstance method fills the properties of custom classes MySeries and MyInstance with the presentation state modality "PR", and adds these classes to a MatchingParameterList so that the stored presentation state instances can be deleted from the custom database
  • Modify the FindPresentationInstanced()  method so that it uses the custom ICatalogEntity classes (MySeries and MyInstance).  The changes are shown in yellow.

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 ) ;

         }

 

 

·         Build the project to generate the new Leadtools.Medical.WebViewer.Addins assembly.

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

·         Close any browsers running an instance of the Medical Viewer

·         You can find the location of the medical web viewer services Bin folder by

§         Start the Internet Information Services (IIS) Manager

§         In the connections pane, open the tree view until you find the MedicalViewerService site.

§         Right-click the Bin folder, and select Explore – this opens the Bin folder of the Medical Viewer Service:

§        

§         The default bin location for the medical web viewer services is here:
C:\LEADTOOLS 18\Examples\PACSFramework\MedicalWebViewer\Leadtools.Medical.WebViewer.WCF\Bin

·         Copy Leadtools.Medical.WebViewer.Addins.dll  and Leadtools.Medical.WebViewer.WCF.dll to the Medical Viewer Service Bin folder

§         If you cannot overwrite the existing versions of these assemblies, do the following:

§         Start a cmd box

§         At the prompt, enter the iisreset command, and hit return

§         Try again to copy Leadtools.Medical.WebViewer.Addins.dll  and Leadtools.Medical.WebViewer.WCF.dll to the Medical Viewer Service Bin folder

·         Copy the My.Medical.Storage.DataAccessLayer.dll assembly to the Medical Viewer Service Bin folder

 

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

§         Login with the Username and Password credentials that you defined during database configuration

§         Click the Search button to display the existing studies in the custom database

§         Click one of the studies to display the existing series in the custom database

§         Click one of the series to display the images of the series

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.