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
}
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.