Clearcanvas Connection string for ImageServer “EndpointAddress”
-
24-10-2019 - |
Question
NOTE:: I have also asked this question on the Clearcanvas forums at:: http://www.clearcanvas.ca/dnn/tabid/69/afv/topic/aff/11/aft/15086/Default.aspx
Hi, i'm making my own ImageViewer in WPF & now need to load DICOM files with the ImageServer. I'm NOT using the Workstation as a starting point, i'm making a viewer from scratch using the (ClearCanvas.Dicom.dll). I have set up the ImageServer on my computer for testing & can connect to it with the workstation app, but not with my app(& that is my problem).
When I try to connect to the ImageServer via the code below the connection times out. I can connect to my ImageServer with the Workstation app. I'm not sure how to configure my connection string I think.
{
EndpointAddress endpoint = new EndpointAddress("http://localhost:104/ClearCanvas/ImageViewer/Automation?wsdl");
StudyRootQueryServiceClient client = new StudyRootQueryServiceClient(binding, endpoint);
client.Open();
}
Here is the setting I use in the Workstation to connect, so how do I translate this to a connection string??
{
Server Name= ImageServer
Host= localhost
AE Title= SERVERAE
Port= 104
}
Solution
I'd assume you would want to load the images from the ImageServer via DICOM. This would require a DICOM C-FIND request against the ImageServer to retrieve the list of studies on the ImageServer. You would then need to select a specific study and issue a DICOM C-MOVE request to move the study to your application. Note also that you will need a DICOM Storage SCP application to listen for incoming DICOM associations and your application will have to be configured as a device on the ImageServer.
To issue a C-FIND request using the ClearCanvas DICOM library, the following code could be used:
StudyRootFindScu findScu = new StudyRootFindScu();
StudyQueryIod queryMessage = new StudyQueryIod();
queryMessage.QueryRetrieveLevel = QueryRetrieveLevel.Study;
queryMessage.SetCommonTags();
IList results = findScu.Find("LocalAETitle", "SERVERAE", "localhost", 104, queryMessage);
foreach (StudyQueryIod item in results)
{
string AccessionNumber = item.AccessionNumber;
string PatientID = item.PatientId;
string Sex = item.PatientsSex;
DateTime BirthDate = item.PatientsBirthDate;
string StudyName = item.StudyDescription;
string PatientName = item.PatientsName;
string StudyUID = item.StudyInstanceUid;
DateTime StudyDate = item.StudyDate.Value;
string Modality = item.Modality;
string ReferringPhysiciansName = item.ReferringPhysiciansName;
}
Note that if you want to "filter" your query, you could set additional tags to match on in the queryMessage.
Once you've selected a study from the resuts, to Issue a DICOM C-MOVE request, the following code could be used:
string studyInstanceUid = "1.1.1."; // Fill in with the real Study Instance UID
ClearCanvas.Dicom.Network.Scu.MoveScuBase moveScu = new ClearCanvas.Dicom.Network.Scu.StudyRootMoveScu("LocalAETitle", "SERVERAE", "localhost", 104, "LocalAETitle");
moveScu.AddStudyInstanceUid(studyInstanceUid);
moveScu.Move();
Finally, the ClearCanvas source does have a Storage SCP implementation. I would suggest looking at the file in Trunk\Dicom\Samples\StorageScp.cs. This takes a fair amount of extra code to implement.
OTHER TIPS
This is a NOTE / INFO for others::
As "Steve Wranovsky" stated, take a look at StarageScp.cs in the clearcanvas src. In there you will find the StorageScp class that I have successfully used to accomplish retrieving a file from my ImageServer. First make sure you configure your Device port in your ImageServer under Admin/Configure/Devices to 106 or something.
Then this is how you start the StorageScp class to Listen on your port.
StorageScp.StorageLocation = @"C:\Users\USER\Downloads\DICOM\ScpTEST";
StorageScp.StartListening("LocalAETitle", 106);
while(!StorageScp.Started) System.Threading.Thread.Sleep(10);
Remember to stop Listening when you close your app.
StorageScp.StopListening(106);
Then you just make your C-Move call to receive your DICOM file while your StorageScp class is listening.
MoveScuBase moveScu = new StudyRootMoveScu("LocalAETitle", "SERVERAE", "localhost", 104, "LocalAETitle");
moveScu.AddStudyInstanceUid(StudyUID);
moveScu.Move();
Also if you would like to send a file to the ImageServer look at StorageScu.cs & to use the class do something like this...
StorageScu scu = new StorageScu();
scu.AddFileToSend(d.FileName);
scu.Send("LocalAETitle", "SERVERAE", "localhost", 104);