本文整理汇总了C#中ClearCanvas.Dicom.DicomMessageBase类的典型用法代码示例。如果您正苦于以下问题:C# DicomMessageBase类的具体用法?C# DicomMessageBase怎么用?C# DicomMessageBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DicomMessageBase类属于ClearCanvas.Dicom命名空间,在下文中一共展示了DicomMessageBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertStudyDelete
private IWorkItemProcessor InsertStudyDelete(DicomMessageBase msg, WorkItemPriorityEnum priority, WorkItemStatusEnum status)
{
var rq = new WorkItemInsertRequest
{
Request = new DeleteStudyRequest
{
Patient = new WorkItemPatient(msg.DataSet),
Study = new WorkItemStudy(msg.DataSet),
Priority = priority
}
};
var rsp = WorkItemService.Instance.Insert(rq);
var updateRequest = new WorkItemUpdateRequest
{
Status = status,
Identifier = rsp.Item.Identifier
};
WorkItemService.Instance.Update(updateRequest);
using (var context = new DataAccessContext(DataAccessContext.WorkItemMutex))
{
var broker = context.GetWorkItemBroker();
var d = new DeleteStudyItemProcessor();
d.Initialize(new WorkItemStatusProxy(broker.GetWorkItem(rsp.Item.Identifier)));
return d;
}
}
示例2: LoadRequestAttributes
/// <summary>
/// Load the values for the sequence <see cref="DicomTags.RequestAttributesSequence"/>
/// into a response message for a specific series.
/// </summary>
/// <param name="read">The connection to use to read the values.</param>
/// <param name="response">The message to add the values into.</param>
/// <param name="row">The <see cref="Series"/> entity to load the related <see cref="RequestAttributes"/> entity for.</param>
private static void LoadRequestAttributes(IPersistenceContext read, DicomMessageBase response, Series row)
{
var select = read.GetBroker<IRequestAttributesEntityBroker>();
var criteria = new RequestAttributesSelectCriteria();
criteria.SeriesKey.EqualTo(row.GetKey());
IList<RequestAttributes> list = select.Find(criteria);
if (list.Count == 0)
{
response.DataSet[DicomTags.RequestAttributesSequence].SetNullValue();
return;
}
foreach (RequestAttributes request in list)
{
var item = new DicomSequenceItem();
item[DicomTags.ScheduledProcedureStepId].SetStringValue(request.ScheduledProcedureStepId);
item[DicomTags.RequestedProcedureId].SetStringValue(request.RequestedProcedureId);
response.DataSet[DicomTags.RequestAttributesSequence].AddSequenceItem(item);
}
}
示例3: Validate
/// <summary>
/// Validates the contents in the <see cref="DicomMessageBase"/> object.
/// </summary>
/// <param name="message"></param>
/// <exception cref="DicomDataException"/> is thrown if the DICOM object fails the validation.
public void Validate(DicomMessageBase message)
{
String studyInstanceUid = message.DataSet[DicomTags.StudyInstanceUid].GetString(0, string.Empty);
String seriesInstanceUid = message.DataSet[DicomTags.SeriesInstanceUid].GetString(0, string.Empty);
String sopInstanceUid = message.DataSet[DicomTags.SopInstanceUid].GetString(0, string.Empty);
if (String.IsNullOrEmpty(studyInstanceUid))
{
throw new DicomDataException("Study Instance UID is missing or empty");
}
if (studyInstanceUid.Length > 64 || seriesInstanceUid.Length > 64 || sopInstanceUid.Length > 64)
{
if (studyInstanceUid.Length > 64)
throw new DicomDataException(string.Format("Study Instance UID is > 64 bytes in the SOP Instance : {0}", studyInstanceUid));
if (seriesInstanceUid.Length > 64)
throw new DicomDataException(string.Format("Series Instance UID is > 64 bytes in the SOP Instance : {0}", seriesInstanceUid));
throw new DicomDataException(string.Format("SOP Instance UID is > 64 bytes in the SOP Instance : {0}", sopInstanceUid));
}
if (studyInstanceUid.EndsWith("."))
throw new DicomDataException(string.Format("Study Instance UID ends with period : {0}", studyInstanceUid));
if (seriesInstanceUid.EndsWith("."))
throw new DicomDataException(string.Format("Series Instance UID ends with period : {0}", seriesInstanceUid));
if (sopInstanceUid.EndsWith("."))
throw new DicomDataException(string.Format("SOP Instance UID ends with period : {0}", sopInstanceUid));
}
示例4: ServerActionContext
public ServerActionContext(DicomMessageBase msg, ServerEntityKey filesystemKey,
ServerPartition partition, ServerEntityKey studyLocationKey)
{
Message = msg;
ServerPartitionKey = partition.Key;
StudyLocationKey = studyLocationKey;
FilesystemKey = filesystemKey;
ServerPartition = partition;
}
示例5: DicomCompressedPixelData
public DicomCompressedPixelData(DicomMessageBase msg, byte[] frameData) : base(msg)
{
_sq = new DicomFragmentSequence(DicomTags.PixelData);
AddFrameFragment(frameData);
//ByteBuffer buffer = new ByteBuffer(frameData);
//DicomFragment fragment = new DicomFragment(buffer);
//_sq.AddFragment(fragment);
NumberOfFrames = 1;
}
示例6: UpdateWorkQueueCommand
public UpdateWorkQueueCommand(DicomMessageBase message, StudyStorageLocation location, bool duplicate, string extension, string uidGroupId)
: base("Update/Insert a WorkQueue Entry")
{
Platform.CheckForNullReference(message, "Dicom Message object");
Platform.CheckForNullReference(location, "Study Storage Location");
_message = message;
_storageLocation = location;
_duplicate = duplicate;
_extension = extension;
_uidGroupId = uidGroupId;
}
示例7: UpdateWorkQueueCommand
public UpdateWorkQueueCommand(DicomMessageBase message, StudyStorageLocation location, bool duplicate, WorkQueueData data=null, WorkQueueUidData uidData=null, ExternalRequestQueue request=null, WorkQueuePriorityEnum priority=null)
: base("Update/Insert a WorkQueue Entry")
{
Platform.CheckForNullReference(message, "Dicom Message object");
Platform.CheckForNullReference(location, "Study Storage Location");
_message = message;
_storageLocation = location;
_duplicate = duplicate;
_data = data;
_request = request;
_uidData = uidData;
_priority = priority;
}
示例8: LoadModalitiesInStudy
/// <summary>
/// Load the values for the tag <see cref="DicomTags.ModalitiesInStudy"/> into a response
/// message for a specific <see cref="Study"/>.
/// </summary>
/// <param name="read">The connection to use to read the values.</param>
/// <param name="response">The message to add the value into.</param>
/// <param name="key">The <see cref="ServerEntityKey"/> for the <see cref="Study"/>.</param>
private static void LoadModalitiesInStudy(IPersistenceContext read, DicomMessageBase response, ServerEntityKey key)
{
var select = read.GetBroker<IQueryModalitiesInStudy>();
var parms = new ModalitiesInStudyQueryParameters { StudyKey = key };
IList<Series> list = select.Find(parms);
string value = "";
foreach (Series series in list)
{
value = value.Length == 0
? series.Modality
: String.Format("{0}\\{1}", value, series.Modality);
}
response.DataSet[DicomTags.ModalitiesInStudy].SetStringValue(value);
}
示例9: GetSopListForPatient
/// <summary>
/// Create a list of SOP Instances to move based on a Patient level C-MOVE-RQ.
/// </summary>
/// <param name="read"></param>
/// <param name="msg"></param>
/// <param name="errorComment"> </param>
/// <returns></returns>
private bool GetSopListForPatient(IPersistenceContext read, DicomMessageBase msg, out string errorComment)
{
errorComment = string.Empty;
string patientId = msg.DataSet[DicomTags.PatientId].GetString(0, "");
var select = read.GetBroker<IStudyEntityBroker>();
var criteria = new StudySelectCriteria();
criteria.PatientId.EqualTo(patientId);
criteria.ServerPartitionKey.EqualTo(Partition.Key);
IList<Study> studyList = select.Find(criteria);
bool bOfflineFound = false;
foreach (Study study in studyList)
{
StudyStorageLocation location;
try
{
FilesystemMonitor.Instance.GetReadableStudyStorageLocation(Partition.Key, study.StudyInstanceUid,
StudyRestore.True, StudyCache.True, out location);
}
catch (StudyIsNearlineException e)
{
errorComment = string.Format(e.RestoreRequested ? "Study is nearline, inserted restore request: {0}" : "Study is nearline: {0}", study.StudyInstanceUid);
bOfflineFound = true;
continue;
}
catch (Exception e)
{
errorComment = string.Format("Exception occurred when determining study location: {0}", e.Message);
bOfflineFound = true;
continue;
}
StudyXml theStream = LoadStudyXml(location);
_theScu.LoadStudyFromStudyXml(location.GetStudyPath(), theStream);
}
return !bOfflineFound;
}
示例10: ProcessStoredDuplicateFile
/// <summary>
/// Process the duplicate with the supplied <see cref="DuplicateProcessingEnum"/>
/// </summary>
/// <param name="context">The processing context</param>
/// <param name="message">A subset of the message stored in <paramref name="sourceFilename"/></param>
/// <param name="sourceFilename">The location of the filename that is a duplicate</param>
/// <param name="data">The data</param>
/// <param name="duplicate">How the processor should handle the duplicate</param>
public static void ProcessStoredDuplicateFile(SopInstanceProcessorContext context,
string sourceFilename,
DicomMessageBase message,
StudyProcessWorkQueueData data,
DuplicateProcessingEnum duplicate)
{
SaveDuplicateFile(context, message.DataSet[DicomTags.SopInstanceUid].ToString(), sourceFilename);
var uidData = new WorkQueueUidData
{
Extension = ServerPlatform.DuplicateFileExtension,
GroupId = context.Group,
DuplicateProcessing = duplicate
};
if (context.Request != null)
uidData.OperationToken = context.Request.OperationToken;
context.CommandProcessor.AddCommand(
new UpdateWorkQueueCommand(message, context.StudyLocation, true, data, uidData, context.Request));
}
示例11: GetExistingOrCreateNewStudy
/// <summary>
/// Traverse at the Study level to check if a Study exists or create a Study if it doesn't exist.
/// </summary>
/// <param name="studies"></param>
/// <param name="file"></param>
/// <returns></returns>
private static DirectoryRecordSequenceItem GetExistingOrCreateNewStudy(DirectoryRecordSequenceItem studies, DicomMessageBase file)
{
DirectoryRecordSequenceItem currentStudy = studies;
while (currentStudy != null)
{
if (currentStudy[DicomTags.StudyInstanceUid].Equals(file.DataSet[DicomTags.StudyInstanceUid]))
{
return currentStudy;
}
if (currentStudy.NextDirectoryRecord == null)
{
currentStudy.NextDirectoryRecord = CreateStudyItem(file);
return currentStudy.NextDirectoryRecord;
}
currentStudy = currentStudy.NextDirectoryRecord;
}
return null;
}
示例12: DicomUncompressedPixelData
/// <summary>
/// Initializes a <see cref="DicomUncompressedPixelData"/> from the attributes in a DICOM file/message.
/// </summary>
/// <param name="dicomMessage">A DICOM file/message from which to initialize the properties of the <see cref="DicomUncompressedPixelData"/>.</param>
public DicomUncompressedPixelData(DicomMessageBase dicomMessage)
: base(dicomMessage)
{
_pd = dicomMessage.DataSet[DicomTags.PixelData];
InitializeFrameData(this, _pd);
}
示例13: GetExistingOrCreateNewPatient
/// <summary>
/// Traverse at the Patient level to check if a Patient exists or create a Patient if it doesn't exist.
/// </summary>
/// <param name="patients"></param>
/// <param name="file"></param>
/// <returns></returns>
private static DirectoryRecordSequenceItem GetExistingOrCreateNewPatient(DirectoryRecordSequenceItem patients, DicomMessageBase file)
{
DirectoryRecordSequenceItem currentPatient = patients;
while (currentPatient != null)
{
if (currentPatient[DicomTags.PatientId].Equals(file.DataSet[DicomTags.PatientId])
&& currentPatient[DicomTags.PatientsName].Equals(file.DataSet[DicomTags.PatientsName]))
{
return currentPatient;
}
if (currentPatient.NextDirectoryRecord == null)
{
currentPatient.NextDirectoryRecord = CreatePatientItem(file);
return currentPatient.NextDirectoryRecord;
}
currentPatient = currentPatient.NextDirectoryRecord;
}
return null;
}
示例14: LogDifferences
private static void LogDifferences(DicomMessageBase message, DifferenceCollection list)
{
string sopInstanceUid = message.DataSet[DicomTags.SopInstanceUid].GetString(0, String.Empty);
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Found {0} issue(s) in SOP {1}\n", list.Count, sopInstanceUid);
sb.Append(list.ToString());
Platform.Log(LogLevel.Warn, sb.ToString());
}
示例15: UpdateMessage
/// <summary>
/// Update a <see cref="DicomMessageBase"/> with the pixel data contained
/// within this object and also update pixel data related tags.
/// </summary>
/// <param name="message"></param>
public override void UpdateMessage(DicomMessageBase message)
{
UpdateAttributeCollection(message.DataSet);
DicomFile file = message as DicomFile;
if (file != null)
file.TransferSyntax = TransferSyntax;
}