Sample Database for the LEAD Storage Server (original) (raw)
Step 1: Configure the LEAD Storage Server with the Shipping Database Schema
- Install the LEADTOOLS toolkit
- Run the CSPacsDatabaseConfigurationDemo_Original.exe to create the database (the shipping schema)
- Run the CSPacsConfigDemo_Original.exe to create the PACS Services and configure the clients
- If you will be connecting the sample database to the LEAD HTML5 Medical Viewer Custom Database, then run the WebViewerConfiguration_Original.exe to configure the LEAD HTML5 Medical Viewer. If you are not doing this, then you can skip this step.
Step 2: Create the Custom Storage Data Access Layer, and Configuration Assemblies
- Start Visual Studio
- Open and compile the project My.Medical.Storage.DataAccessLayer project. The default location is
C:\LEADTOOLS22\Examples\Medical\DotNet\Tutorials\My.Medical.Storage.DataAccessLayer
Note: If you are using earlier versions of SQL Server 2008 (i.e. SQL Server 2005), there is no support for the data type SqlDbType.Date. In this case, you have choices:- Open MyDataSet.Designer.cs, and replace all instances of SqlDbType.Date with SqlDbType.DateTime
- Follow the steps in Strongly Typed DataSet Class and XML Schema to generate a new instance of MyDataSet.Designer.cs.
- Open and compile the My.Medical.Storage.Configuration project. The default location is
C:\LEADTOOLS22\Examples\Medical\DotNet\Tutorials\My.Medical.Storage.Configuration
. - Compiling the projects will generate two assemblies:
- My.Medical.Storage.DataAccessLayer.dll
- My.Medical.Storage.Configuration.dll
- Copy My.Medical.Storage.DataAccessLayer.dll to LEAD Installation BIN folder
- The default BIN installation location is C:\LEADTOOLS22\Bin\Dotnet4\Win32
- Copy My.Medical.Storage.Configuration.dll to configuration folder
- {LEAD Installation BIN}/{ServiceName}/ Configuration
- The default is C:\LEADTOOLS22\Bin\Dotnet4\Win32\L21_PACS_SCP32\Configuration
Step 3: Create the Sample Database
This tutorial uses Microsoft SQL Server 2008 and SQL Server Management Studio. You can also use SQL Compact Edition, which is installed by default when you install Visual Studio. If you use SQL Compact Edition, you can download SQL Server Management Studio Express (a free download from Microsoft).
- Start Microsoft SQL Server Management Studio
- Click New Query
- Paste the script below in the New Query window
- Click Execute to generate the database.
Script to generate the tutorial database for SQL Server 2008
USE [master]
GO
/****** Object: Database [MyDicomDb] Script Date: 07/15/2013 13:02:13 ******/
CREATE DATABASE [MyDicomDb]
GO
ALTER DATABASE [MyDicomDb] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [MyDicomDb].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [MyDicomDb] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_NULLS OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_PADDING OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [MyDicomDb] SET ARITHABORT OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [MyDicomDb] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [MyDicomDb] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [MyDicomDb] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [MyDicomDb] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [MyDicomDb] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [MyDicomDb] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [MyDicomDb] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [MyDicomDb] SET DISABLE_BROKER
GO
ALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [MyDicomDb] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [MyDicomDb] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [MyDicomDb] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [MyDicomDb] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [MyDicomDb] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [MyDicomDb] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [MyDicomDb] SET READ_WRITE
GO
ALTER DATABASE [MyDicomDb] SET RECOVERY FULL
GO
ALTER DATABASE [MyDicomDb] SET MULTI_USER
GO
ALTER DATABASE [MyDicomDb] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [MyDicomDb] SET DB_CHAINING OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'MyDicomDb', N'ON'
GO
USE [MyDicomDb]
GO
/****** Object: Table [dbo].[MyPatientTable] Script Date: 07/01/2013 17:44:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyPatientTable](
[PatientId] [int] IDENTITY(1,1) NOT NULL,
[PatientIdentification] [nvarchar](70) NOT NULL,
[PatientName] [nvarchar](max) NOT NULL,
[PatientBirthday] [date] NULL,
[PatientSex] [nvarchar](50) NULL,
[PatientComments] [nvarchar](200) NULL,
CONSTRAINT [PK_Patient] PRIMARY KEY CLUSTERED
(
[PatientId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [uc_PatientIdentification] UNIQUE NONCLUSTERED
(
[PatientIdentification] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[MyStudyTable] Script Date: 07/01/2013 17:44:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyStudyTable](
[StudyId] [int] IDENTITY(1,1) NOT NULL,
[StudyPatientId] [int] NOT NULL,
[StudyStudyInstanceUID] [nvarchar](64) NOT NULL,
[StudyStudyDate] [date] NULL,
[StudyAccessionNumber] [nvarchar](64) NULL,
[StudyStudyDescription] [nvarchar](256) NULL,
[StudyReferringPhysiciansName] [nvarchar](50) NULL,
[StudyStudyId] [nvarchar](16) NULL,
CONSTRAINT [PK_Study] PRIMARY KEY CLUSTERED
(
[StudyId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [uc_StudyStudyInstanceUID] UNIQUE NONCLUSTERED
(
[StudyStudyInstanceUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[MySeriesTable] Script Date: 07/01/2013 17:44:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MySeriesTable](
[SeriesId] [int] IDENTITY(1,1) NOT NULL,
[SeriesStudyId] [int] NOT NULL,
[SeriesSeriesInstanceUID] [nvarchar](64) NOT NULL,
[SeriesBodyPartExamined] [nvarchar](16) NULL,
[SeriesSeriesNumber] [int] NULL,
[SeriesSeriesDescription] [nvarchar](300) NULL,
[SeriesSeriesDate] [date] NULL,
[SeriesModality] [nvarchar](50) NULL,
CONSTRAINT [PK_Series] PRIMARY KEY CLUSTERED
(
[SeriesId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [uc_SerieSeriesInstanceUID] UNIQUE NONCLUSTERED
(
[SeriesSeriesInstanceUID] ASC,
[SeriesStudyId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[MyInstanceTable] Script Date: 07/01/2013 17:44:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyInstanceTable](
[ImageId] [bigint] IDENTITY(1,1) NOT NULL,
[ImageSeriesId] [int] NOT NULL,
[SOPInstanceUID] [nvarchar](64) NOT NULL,
[ImageImageNumber] [int] NOT NULL,
[ImageLastStoreDate] [date] NULL,
[ImageFilename] [nvarchar](400) NOT NULL,
[ImageUniqueSOPClassUID] [nvarchar](64) NULL,
[ImageRows] [bigint] NULL,
[ImageColumns] [bigint] NULL,
[ImageBitsAllocated] [bigint] NULL,
CONSTRAINT [PK_Image] PRIMARY KEY CLUSTERED
(
[ImageId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [IX_Image_SOPInstanceUID] UNIQUE NONCLUSTERED
(
[SOPInstanceUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: ForeignKey [FK_DImage_Series] Script Date: 07/01/2013 17:44:15 ******/
ALTER TABLE [dbo].[MyInstanceTable] WITH CHECK ADD CONSTRAINT [FK_DImage_Series] FOREIGN KEY([ImageSeriesId])
REFERENCES [dbo].[MySeriesTable] ([SeriesId])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MyInstanceTable] CHECK CONSTRAINT [FK_DImage_Series]
GO
/****** Object: ForeignKey [FK_Series_Study] Script Date: 07/01/2013 17:44:15 ******/
ALTER TABLE [dbo].[MySeriesTable] WITH CHECK ADD CONSTRAINT [FK_Series_Study] FOREIGN KEY([SeriesStudyId])
REFERENCES [dbo].[MyStudyTable] ([StudyId])
GO
ALTER TABLE [dbo].[MySeriesTable] CHECK CONSTRAINT [FK_Series_Study]
GO
/****** Object: ForeignKey [FK_Study_Patient] Script Date: 07/01/2013 17:44:15 ******/
ALTER TABLE [dbo].[MyStudyTable] WITH CHECK ADD CONSTRAINT [FK_Study_Patient] FOREIGN KEY([StudyPatientId])
REFERENCES [dbo].[MyPatientTable] ([PatientId])
GO
ALTER TABLE [dbo].[MyStudyTable] CHECK CONSTRAINT [FK_Study_Patient]
GO
Note:
For earlier version of SQL Server (i.e. SQL Server 2005), there is no support for the data type SqlDbType.Date.
If you are using SQL Server 2005, you can use the following script to generate the database, which instead uses the data type SqlDbType.DateTime.
Script to generate the tutorial database for SQL Server 2005
USE [master]
GO
/****** Object: Database [MyDicomDb] Script Date: 08/12/2013 10:39:18 ******/
CREATE DATABASE [MyDicomDb]
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [MyDicomDb].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [MyDicomDb] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_NULLS OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_PADDING OFF
GO
ALTER DATABASE [MyDicomDb] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [MyDicomDb] SET ARITHABORT OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [MyDicomDb] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [MyDicomDb] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [MyDicomDb] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [MyDicomDb] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [MyDicomDb] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [MyDicomDb] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [MyDicomDb] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [MyDicomDb] SET DISABLE_BROKER
GO
ALTER DATABASE [MyDicomDb] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [MyDicomDb] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [MyDicomDb] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [MyDicomDb] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [MyDicomDb] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [MyDicomDb] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [MyDicomDb] SET READ_WRITE
GO
ALTER DATABASE [MyDicomDb] SET RECOVERY FULL
GO
ALTER DATABASE [MyDicomDb] SET MULTI_USER
GO
ALTER DATABASE [MyDicomDb] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [MyDicomDb] SET DB_CHAINING OFF
GO
USE [MyDicomDb]
GO
/****** Object: Table [dbo].[MyPatientTable] Script Date: 08/12/2013 10:39:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyPatientTable](
[PatientId] [int] IDENTITY(1,1) NOT NULL,
[PatientIdentification] [nvarchar](70) NOT NULL,
[PatientName] [nvarchar](max) NOT NULL,
[PatientBirthday] [datetime] NULL,
[PatientSex] [nvarchar](50) NULL,
[PatientComments] [nvarchar](200) NULL,
CONSTRAINT [PK_Patient] PRIMARY KEY CLUSTERED
(
[PatientId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [uc_PatientIdentification] UNIQUE NONCLUSTERED
(
[PatientIdentification] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[MyStudyTable] Script Date: 08/12/2013 10:39:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyStudyTable](
[StudyId] [int] IDENTITY(1,1) NOT NULL,
[StudyPatientId] [int] NOT NULL,
[StudyStudyInstanceUID] [nvarchar](64) NOT NULL,
[StudyStudyDate] [datetime] NULL,
[StudyAccessionNumber] [nvarchar](64) NULL,
[StudyStudyDescription] [nvarchar](256) NULL,
[StudyReferringPhysiciansName] [nvarchar](50) NULL,
[StudyStudyId] [nvarchar](16) NULL,
CONSTRAINT [PK_Study] PRIMARY KEY CLUSTERED
(
[StudyId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [uc_StudyStudyInstanceUID] UNIQUE NONCLUSTERED
(
[StudyStudyInstanceUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[MySeriesTable] Script Date: 08/12/2013 10:39:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MySeriesTable](
[SeriesId] [int] IDENTITY(1,1) NOT NULL,
[SeriesStudyId] [int] NOT NULL,
[SeriesSeriesInstanceUID] [nvarchar](64) NOT NULL,
[SeriesBodyPartExamined] [nvarchar](16) NULL,
[SeriesSeriesNumber] [int] NULL,
[SeriesSeriesDescription] [nvarchar](300) NULL,
[SeriesSeriesDate] [datetime] NULL,
[SeriesModality] [nvarchar](50) NULL,
CONSTRAINT [PK_Series] PRIMARY KEY CLUSTERED
(
[SeriesId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [uc_SerieSeriesInstanceUID] UNIQUE NONCLUSTERED
(
[SeriesSeriesInstanceUID] ASC,
[SeriesStudyId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[MyInstanceTable] Script Date: 08/12/2013 10:39:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyInstanceTable](
[ImageId] [bigint] IDENTITY(1,1) NOT NULL,
[ImageSeriesId] [int] NOT NULL,
[SOPInstanceUID] [nvarchar](64) NOT NULL,
[ImageImageNumber] [int] NOT NULL,
[ImageLastStoreDate] [datetime] NULL,
[ImageFilename] [nvarchar](400) NOT NULL,
[ImageUniqueSOPClassUID] [nvarchar](64) NULL,
[ImageRows] [bigint] NULL,
[ImageColumns] [bigint] NULL,
[ImageBitsAllocated] [bigint] NULL,
CONSTRAINT [PK_Image] PRIMARY KEY CLUSTERED
(
[ImageId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [IX_Image_SOPInstanceUID] UNIQUE NONCLUSTERED
(
[SOPInstanceUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: ForeignKey [FK_Study_Patient] Script Date: 08/12/2013 10:39:19 ******/
ALTER TABLE [dbo].[MyStudyTable] WITH CHECK ADD CONSTRAINT [FK_Study_Patient] FOREIGN KEY([StudyPatientId])
REFERENCES [dbo].[MyPatientTable] ([PatientId])
GO
ALTER TABLE [dbo].[MyStudyTable] CHECK CONSTRAINT [FK_Study_Patient]
GO
/****** Object: ForeignKey [FK_Series_Study] Script Date: 08/12/2013 10:39:19 ******/
ALTER TABLE [dbo].[MySeriesTable] WITH CHECK ADD CONSTRAINT [FK_Series_Study] FOREIGN KEY([SeriesStudyId])
REFERENCES [dbo].[MyStudyTable] ([StudyId])
GO
ALTER TABLE [dbo].[MySeriesTable] CHECK CONSTRAINT [FK_Series_Study]
GO
/****** Object: ForeignKey [FK_DImage_Series] Script Date: 08/12/2013 10:39:19 ******/
ALTER TABLE [dbo].[MyInstanceTable] WITH CHECK ADD CONSTRAINT [FK_DImage_Series] FOREIGN KEY([ImageSeriesId])
REFERENCES [dbo].[MySeriesTable] ([SeriesId])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MyInstanceTable] CHECK CONSTRAINT [FK_DImage_Series]
GO
Step 4: Modify GlobalPacs.config to use the New Database
- Make a backup copy of the globalPacs.config file. Rename the backup copy globalPacs_original.config.
- The globalPacs.config file is located in {LEAD Installation BIN} folder
- The default location is C:\LEADTOOLS22\Bin\Dotnet4\Win32
- Open the globalPacs.config file in Visual Studio (or any text editor)
- Comment out the existing storageDataAccessConfiguration175 entry in the configSections, and add a new myStorageDataAccessConfiguration175 section. The new section is highlighted in yellow, below.
<!--<section name="storageDataAccessConfiguration175" type="Leadtools.Medical.DataAccessLayer.Configuration.DataAccessSettings, Leadtools.Medical.DataAccessLayer, Version=21.0.0.1, Culture=neutral, PublicKeyToken=9cf889f53ea9b907" />-->
<section name="myStorageDataAccessConfiguration175" type="Leadtools.Medical.DataAccessLayer.Configuration.DataAccessSettings, Leadtools.Medical.DataAccessLayer, Version=21.0.0.1, Culture=neutral, PublicKeyToken=9cf889f53ea9b907" />
- Comment out the existing StorageServer entry in the storageDataAccessConfiguration175 definition, and add a new myStorageDataAccessConfiguration175 definition. The changes are highlighted in yellow, below.
<storageDataAccessConfiguration175 connectionName="LeadStorageServer21_32">
<!--<add productName="StorageServer" serviceName="L21_PACS_SCP32"
connectionName="LeadStorageServer21_32" />-->
<add productName="Workstation" serviceName="L21_WS_SERVER32"
connectionName="MedicalWorkstation21_32" />
</storageDataAccessConfiguration175>
<myStorageDataAccessConfiguration175 connectionName="MyDicomDb">
<add productName="StorageServer" serviceName=" L21_PACS_SCP32" connectionName="MyDicomDb" />
</myStorageDataAccessConfiguration175>
- Add a new connection string item to the element.
- You can copy and paste the existing connection string, and modify the copy to point to the new database.
- The name is MyDicomDb
- The catalog is MyDicomDb
- The new connection string is shown highlighted in yellow below. The difference between the old version and the new one is that in the old string, the name and catalog are called "LeadStorageServer21_32", whereas in the new string they are called "MyDicomDb".
<connectionStrings>
<add name="LeadStorageServer21_32"
connectionString="Data Source=medical-test;Failover Partner=;Initial Catalog=LeadStorageServer21_32;Integrated Security=False;User ID=sa;Password=sa;Pooling=True"
providerName="System.Data.SqlClient" />
<add name="MyDicomDb" connectionString="Data Source=medical-test;Failover Partner=;Initial Catalog=MyDicomDb;Integrated Security=False;User ID=sa;Password=sa;Pooling=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
- Note:
The Data Source here is “medical-test”. You should change this to point to your SQL Server with the machine name followed by the SQL Server name, eg: Data Source=”myMachineName\SQLServer” You may need to change the SQL Server ID and password to successfully authenticate as well.
- Save the changes to globalPacs.config, and close the file.
Step 5: Copy the Following Files to {LEAD Installation BIN}
- MyQueryIOD.xml
- See Specifying C-FIND-Rsp DICOM Elements for instructions on creating MyQueryIOD.xml
- The default location is in C:\LEADTOOLS22\Examples\Medical\DotNet\Tutorials\SupportFiles
- MyCatalog.xml
- See Storage Catalog for instructions on creating MyCatalog.xml
- The default location is in C:\LEADTOOLS22\Examples\Medical\DotNet\Tutorials\SupportFiles
- MyDataSet.xsd
- Creating the Strongly Typed DataSet Class and the XML Schema File for instructions on creating MyDataSet.xsd
- The default location is in C:\LEADTOOLS22\Examples\Medical\DotNet\Tutorials\My.Medical.Storage.DataAccessLayer\src\DataAccessLogic\BusinessEntity
- Database manager configuration files
- PatientLevel.xml
- StudiesLevel.xml
- SeriesLevel.xml
- ImagesLevel.xml
- See Database Mapping for the Database Manager for instructions on creating the database manager configuration files
- All XML files can be found in C:\LEADTOOLS22\Examples\Medical\DotNet\Tutorials\SupportFiles
Step 6: Rebuild the StorageServerManagerDemo_Original.exe with Modifications
- Start Visual Studio 2010
- Open the StorageServerManager_4.csproj project file
- The default location for the project file is here:
C:\LEADTOOLS22\Examples\Medical\DotNet\StorageServerManager
.
- The default location for the project file is here:
- Add a reference to My.Medical.Storage.DataAccessLayer.dll
- In Solution Explorer, right-click the References folder
- Select Add Reference…
- Click the Browse tab
- Browse to the {LEAD Installation BIN} folder
* The default location is C:\LEADTOOLS22\Bin\Dotnet4\Win32 - Select My.Medical.Storage.DataAccessLayer.dll
- Click OK
- Modify shell.cs
- Note that all of these changes are already in the shipping version of shell.cs, wrapped in directives
* #if TUTORIAL_CUSTOM_DATABASE
* #endif
If you have the shipping version, open the project properties and go to the Build tab. You can add the TUTORIAL_CUSTOM_DATABASE conditional here. Then build StorageServerManagerDemo_Original.exe and skip to step 7. - The default location is
C:\LEADTOOLS22\Examples\Medical\DotNet\StorageServerManager\Shell\Shell.cs
. - Add the following using statements to the top of shell.cs
// Code changes for Tutorial
using Leadtools.Medical.Storage.DataAccessLayer.Interface;
using My.Medical.Storage.DataAccessLayer;
using My.Medical.Storage.DataAccessLayer.Entities;
// Code changes for Tutorial
- Note that all of these changes are already in the shipping version of shell.cs, wrapped in directives
- Add the following to the Run() method, immediately after the call to CreateConfigurationServices ( service ) ;
// Code changes for Tutorial
DataAccessServiceLocator.Register<IPatientInfo>(new MyPatientInfo());
DataAccessServiceLocator.Register<IStudyInfo>(new MyStudyInfo());
DataAccessServiceLocator.Register<ISeriesInfo>(new MySeriesInfo());
DataAccessServiceLocator.Register<IInstanceInfo>(new MyInstanceInfo());
RegisteredEntities.Items.Add(RegisteredEntities.PatientEntityName, typeof(MyPatient));
RegisteredEntities.Items.Add(RegisteredEntities.StudyEntityName, typeof(MyStudy));
RegisteredEntities.Items.Add(RegisteredEntities.SeriesEntityName, typeof(MySeries));
RegisteredEntities.Items.Add(RegisteredEntities.InstanceEntityName, typeof(MyInstance));
// Code changes for Tutorial
- In the RegisterDataAccessLayers() method, change the following statement to create an instance of MyStorageDataAccessConfigurationView. The change is highlighted in yellow:
storageAgent = DataAccessFactory.GetInstance ( new MyStorageDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent> ( ) ;
- Modify Program.cs
- The default location is
C:\LEADTOOLS22\Examples\Medical\DotNet\StorageServerManager\Program.cs
. - In the Main() method, make the following change (highlighted in yellow) so that the StorageServerManagerDemo_Original.exe demo does not falsely detect that the database has not been configured.
bool dbConfigured = GlobalPacsUpdater.IsDbComponentsConfigured(productsToCheck, out message);
dbConfigured = true;
- The default location is
- Modify StorageServerContainerPresenter.cs
- The default location is
C:\LEADTOOLS22\Examples\Medical\DotNet\StorageServerManager\UI\StorageServerContainer\StorageServerContainerPresenter.cs
. - Add the following using statements to the top of StorageServerContainerPresenter.cs
// Code changes for Tutorial
using My.Medical.Storage.DataAccessLayer;
using My.Medical.Storage.DataAccessLayer.Entities;
using Leadtools.Dicom.Common.DataTypes;
using Leadtools.Medical.Winforms.Control;
using Leadtools.Dicom.Common.Extensions;
// Code changes for Tutorial
- The default location is
- After the RunView() method, insert the MyPrepareSearch() method. See Assigning the StorageDatabaseManager.PrepareSearch delegate for an explanation of the delegate.
private void MyPrepareSearch(MatchingParameterCollection matchingCollection)
{
DicomQueryParams q = __DbManager.GetDicomQueryParams();
try
{
MatchingParameterList matchingList = new MatchingParameterList();
MyPatient patient = new MyPatient();
MyStudy study = new MyStudy();
MySeries series = new MySeries();
matchingList.Add(patient);
matchingList.Add(study);
matchingList.Add(series);
matchingCollection.Add(matchingList);
study.StudyAccessionNumber = q.AccessionNumber;
patient.PatientIdentification = q.PatientId;
if (!string.IsNullOrEmpty(q.PatientName.FamilyName))
patient.PatientName = q.PatientName.FamilyName.TrimEnd('*') + "*";
if (!string.IsNullOrEmpty(q.PatientName.GivenName))
patient.PatientName = q.PatientName.GivenName.TrimEnd('*') + "*";
if (!string.IsNullOrEmpty(q.Modalities))
series.SeriesModality = q.Modalities.Replace(",", "\\"); ;
if (!string.IsNullOrEmpty(q.SeriesDescription))
series.SeriesSeriesDescription = q.SeriesDescription.TrimEnd('*') + "*";
if (!string.IsNullOrEmpty(q.ReferringPhysiciansName.FamilyName))
study.StudyReferringPhysiciansName = q.ReferringPhysiciansName.FamilyName.TrimEnd('*') + "*"; ;
if (!string.IsNullOrEmpty(q.ReferringPhysiciansName.GivenName))
study.StudyReferringPhysiciansName = q.ReferringPhysiciansName.GivenName.TrimEnd('*') + "*"; ;
if (q.StudyFromChecked || q.StudyToChecked)
{
DateRange studyDateRange = new DateRange();
if (q.StudyFromChecked)
{
studyDateRange.StartDate = q.StudyFromDate;
}
if (q.StudyToChecked)
{
studyDateRange.EndDate = q.StudyToDate;
}
study.StudyStudyDate = studyDateRange;
}
if (q.StorageDateChecked)
{
MyInstance instance = new MyInstance();
DateRange dateRange = new DateRange();
DateRangeFilter StorageDateRangeFilter = q.StorageDateRange;
string startDate = StorageDateRangeFilter.DateRangeFrom;
string endDate = StorageDateRangeFilter.DateRangeTo;
if (StorageDateRangeFilter.SelectedDateFilter == DateRangeFilter.RangeFilterType.DateRange)
{
if (!string.IsNullOrEmpty(startDate))
{
dateRange.StartDate = DateTime.Parse(startDate);
}
if (!string.IsNullOrEmpty(endDate))
{
dateRange.EndDate = DateTime.Parse(endDate);
}
}
else if (StorageDateRangeFilter.SelectedDateFilter == DateRangeFilter.RangeFilterType.Months)
{
DateTime lastMonthsDate = DateTime.Now.SubtractMonths(Convert.ToInt32(StorageDateRangeFilter.LastMonths));
dateRange.StartDate = lastMonthsDate;
dateRange.EndDate = DateTime.Now;
}
else
{
TimeSpan subtractionDays = new TimeSpan(Convert.ToInt32(StorageDateRangeFilter.LastDays),
DateTime.Now.Hour,
DateTime.Now.Minute,
DateTime.Now.Second,
DateTime.Now.Millisecond);
dateRange.StartDate = DateTime.Now.Subtract(subtractionDays);
dateRange.EndDate = DateTime.Now;
}
instance.ImageLastStoreDate = dateRange;
matchingList.Add(instance);
}
study.StudyStudyId = q.StudyId;
}
catch (Exception exception)
{
throw exception;
}
finally
{
// do nothing ;
}
}
- In the CreateContainerPages( ) method, assign the PrepareSearchDelegate
StorageDatabaseManager dbManager = new StorageDatabaseManager ( ) ;
dbManager.PrepareSearch = new PrepareSearchDelegate(MyPrepareSearch);
- In the CreateContainerPages( ) method, , add a call to get the query parameters
ServerState.Instance.LicenseChanged += new EventHandler(Instance_LicenseChanged);
dbManager.GetDicomQueryParams();
- In the ConfigureServerInfoConrol ( ) method, modify the GetConnectionString call to use the custom configuration
storage = GetConnectionString(configPacs, configMachine,
new MyStorageDataAccessConfigurationView(configPacs, PacsProduct.ProductName, null).DataAccessSettingsSectionName);
- Build StorageServerManagerDemo_Original.exe
Step 7: Modify Application Configuration Files to use the Storage Catalog and DataSet Schema
- Modify Leadtools.Dicom.Server.exe.config (additions are highlighted in yellow)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="leadLogging" type="Leadtools.Logging.Configuration.ConfigSectionHandler, Leadtools.Logging" />
<section name="xmlStorageCatalogSettings" type="Leadtools.Medical.Storage.DataAccessLayer.XmlStorageCatalogSettings, Leadtools.Medical.Storage.DataAccessLayer" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Leadtools.Dicom.Service.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<leadLogging>
<channels>
<channel name="DataAccessLoggingChannel" type="Leadtools.Medical.Logging.DataAccessLayer.DataAccessLoggingChannel, Leadtools.Medical.Logging.DataAccessLayer" />
</channels>
</leadLogging>
<xmlStorageCatalogSettings catalogPath="C:\LEADTOOLS22\Bin\Dotnet4\Win32\MyCatalog.xml"/>
<runtime>
<generatePublisherEvidence enabled="false"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845DCD8080CC91" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.5.1.0" newVersion="3.5.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.ObjectBuilder2" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="LicenseFile" value=""/>
<add key="DeveloperKey" value=""/>
<add key="DataSetSchema" value=" C:\LEADTOOLS22\Bin\Dotnet4\Win32\MyDataSet.xsd"/>
</appSettings>
</configuration>
- Modify StorageServerManagerDemo_Original.exe.config (additions are highlighted in yellow)
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="xmlStorageCatalogSettings" type="Leadtools.Medical.Storage.DataAccessLayer.XmlStorageCatalogSettings, Leadtools.Medical.Storage.DataAccessLayer" />
</configSections>
<xmlStorageCatalogSettings catalogPath="C:\LEADTOOLS22\Bin\Dotnet4\Win32\MyCatalog.xml"/>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845DCD8080CC91" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.5.1.0" newVersion="3.5.1.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.ObjectBuilder2" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="DataSetSchema" value=" C:\LEADTOOLS22\Bin\Dotnet4\Win32\MyDataSet.xsd"/>
</appSettings>
</configuration>
Step 8: Configure the Storage Server Manager to use MyQueryIOD.xml
- Run StorageServerManagerDemo_Original.exe
- Login with the Username and Password credentials that you defined during database configuration
- Open the Query Settings, and set the IOD XML Path to be your MyQueryIOD.xml file.
- See Specifying C-FIND-Rsp DICOM Elements for instructions on creating MyQueryIOD.xml
Step 9: (Optional) Configure the Forward Feature
- Create the Forward table and add it to the MyDicomDb database
- Start Microsoft SQL Server Management Studio
- Click New Query
- Paste the script below in the New Query window
- Click Execute to add the Forward table to MyDicomDb.
Script to create the Forward table
USE [MyDicomDb]
GO
/****** Object: Table [dbo].[Forward] Script Date: 09/04/2013 15:55:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Forward](
[SOPInstanceUID] [nvarchar](64) NOT NULL,
[ForwardDate] [datetime] NULL,
[ExpireDate] [datetime] NULL,
CONSTRAINT [PK_Forward] PRIMARY KEY CLUSTERED
(
[SOPInstanceUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Forward] WITH CHECK ADD CONSTRAINT [FK_Forward_Instance] FOREIGN KEY([SOPInstanceUID])
REFERENCES [dbo].[MyInstanceTable] ([SOPInstanceUID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Forward] CHECK CONSTRAINT [FK_Forward_Instance]
GO
- Modify the Leadtools.Medical.Forward.DataAccessLayer assembly
- Start Visual Studio
- Open the Leadtools.Medical.Forward.DataAccessLayer project
* The default location isC:\LEADTOOLS22\Examples\Medical\DotNet\Medical.Forward.DataAccessLayer
. - Open the ForwardDBDataAccessAgent.cs file
- Add the following to the
ForwardDBDataAccessAgent
constructor:
public ForwardDBDataAccessAgent(string connectionString)
{
#if TUTORIAL_CUSTOM_DATABASE
_instanceTableName = @"MyInstanceTable";
_columnNameSOPInstanceUID = @"SOPInstanceUID";
_columnNameReferencedFile = @"ImageFilename";
#endif
ConnectionString = connectionString;
}
- Open the properties page
- Add TUTORIAL_CUSTOM_DATABASE from the Conditional compilation symbols
- Build the project to generate the new Leadtools.Medical.Forward.DataAccessLayer.dll assembly.
- Modify the GlobalPacs.config
- Open the globalPacs.config file in Visual Studio (or any text editor)
- In the existing
<forwardConfiguration175>
, comment out the existing entry and add a new entry with MyDicomDb as the connection name. The changes are highlighted in yellow below.
<forwardConfiguration175>
<!--<add productName="StorageServer" serviceName="L21_PACS_SCP32" connectionName="LeadStorageServer21_32" />-->
<add productName="StorageServer" serviceName="L21_PACS_SCP32" connectionName="MyDicomDb" />
</forwardConfiguration175>
- Save the changes to globalPacs.config, and close the file
Step 10: Verify that the Storage Server Manager is Using the Custom Database
- Run StorageServerManagerDemo_Original.exe
- Open the Database Manager
- Click the Add DICOM button and add a DICOM file
- You can add image2.dcm, which is installed with the toolkit
- Click the Search button, and verify that the DICOM file has stored in the database
- Click the Start Storage Service button to start the DICOM listening service
- Start the CSDicomHighLevelClient demo, and verify that the newly added DICOM file can be retrieved
- Start the CSDicomHighLevelStore demo, and verify that a DICOM file can be stored to the server
- (Optional) If you completed optional step 9, verify that the Forwarding is working correctly
- Click the control panel
- Click the Forward icon
- Click the Advanced tab
- Select L21_SERVER or any other existing SCP in the Forward To drop down
- Click the Forward button. The dataset(s) should be forwarded to L21_SERVER, and the Clean button should be enabled.
- Click the Clean button.
- Open the Database Manager
- Click the Search button, and verify that the forwarded DICOM file(s) have been removed from database