本文整理汇总了C#中StudyStorageLocation.LoadStudy方法的典型用法代码示例。如果您正苦于以下问题:C# StudyStorageLocation.LoadStudy方法的具体用法?C# StudyStorageLocation.LoadStudy怎么用?C# StudyStorageLocation.LoadStudy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StudyStorageLocation
的用法示例。
在下文中一共展示了StudyStorageLocation.LoadStudy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateStudyState
/// <summary>
/// Validates the state of the study.
/// </summary>
/// <param name="context">Name of the application</param>
/// <param name="studyStorage">The study to validate</param>
/// <param name="modes">Specifying what validation to execute</param>
public void ValidateStudyState(String context, StudyStorageLocation studyStorage, StudyIntegrityValidationModes modes)
{
Platform.CheckForNullReference(studyStorage, "studyStorage");
if (modes == StudyIntegrityValidationModes.None)
return;
using (ServerExecutionContext scope = new ServerExecutionContext())
{
Study study = studyStorage.LoadStudy(scope.PersistenceContext);
if (study!=null)
{
StudyXml studyXml = studyStorage.LoadStudyXml();
if (modes == StudyIntegrityValidationModes.Default ||
(modes & StudyIntegrityValidationModes.InstanceCount) == StudyIntegrityValidationModes.InstanceCount)
{
if (studyXml != null && studyXml.NumberOfStudyRelatedInstances != study.NumberOfStudyRelatedInstances)
{
ValidationStudyInfo validationStudyInfo = new ValidationStudyInfo(study, studyStorage.ServerPartition);
throw new StudyIntegrityValidationFailure(
ValidationErrors.InconsistentObjectCount, validationStudyInfo,
String.Format("Number of instances in database and xml do not match: {0} vs {1}.",
study.NumberOfStudyRelatedInstances,
studyXml.NumberOfStudyRelatedInstances
));
}
}
}
}
}
示例2: HandleDuplicateFile
private DicomProcessingResult HandleDuplicateFile(string sopInstanceUid, StudyStorageLocation studyLocation, ServerCommandProcessor commandProcessor, DicomMessageBase message, string sourceFilename, StudyProcessWorkQueueData data)
{
Study study = studyLocation.Study ??
studyLocation.LoadStudy(ServerExecutionContext.Current.PersistenceContext);
if (study != null)
Platform.Log(LogLevel.Info, "Received duplicate SOP {0} (A#:{1} StudyUid:{2} Patient: {3} ID:{4})",
sopInstanceUid,
study.AccessionNumber, study.StudyInstanceUid,
study.PatientsName, study.PatientId);
else
Platform.Log(LogLevel.Info,
"Received duplicate SOP {0} (StudyUid:{1}). Existing files haven't been processed.",
sopInstanceUid, studyLocation.StudyInstanceUid);
var sopProcessingContext = new SopInstanceProcessorContext(commandProcessor, studyLocation, _context.ContextID,
_context.Request)
{
DuplicateProcessing = _context.DuplicateProcessing
};
DicomProcessingResult result = DuplicateSopProcessorHelper.Process(sopProcessingContext, message, data,
sourceFilename);
return result;
}
示例3: HandleDuplicate
private DicomProcessingResult HandleDuplicate(string sopInstanceUid, StudyStorageLocation studyLocation, ServerCommandProcessor commandProcessor, DicomFile file)
{
Study study = studyLocation.Study ??
studyLocation.LoadStudy(ServerExecutionContext.Current.PersistenceContext);
if (study != null)
Platform.Log(LogLevel.Info, "Received duplicate SOP {0} (A#:{1} StudyUid:{2} Patient: {3} ID:{4})",
sopInstanceUid,
study.AccessionNumber, study.StudyInstanceUid,
study.PatientsName, study.PatientId);
else
Platform.Log(LogLevel.Info,
"Received duplicate SOP {0} (StudyUid:{1}). Existing files haven't been processed.",
sopInstanceUid, studyLocation.StudyInstanceUid);
SopProcessingContext sopProcessingContext = new SopProcessingContext(commandProcessor, studyLocation, _context.ContextID);
DicomProcessingResult result = DuplicateSopProcessorHelper.Process(sopProcessingContext, file);
return result;
}
示例4: ReprocessStudy
/// <summary>
/// Inserts a <see cref="WorkQueue"/> request to reprocess the study
/// </summary>
/// <param name="ctx"></param>
/// <param name="reason"></param>
/// <param name="location"></param>
/// <param name="additionalPaths"></param>
/// <param name="scheduleTime"></param>
/// <returns></returns>
/// <exception cref="InvalidStudyStateOperationException">Study is in a state that reprocessing is not allowed</exception>
///
public WorkQueue ReprocessStudy(IUpdateContext ctx, String reason, StudyStorageLocation location, List<FilesystemDynamicPath> additionalPaths, DateTime scheduleTime)
{
Platform.CheckForNullReference(location, "location");
if (location.StudyStatusEnum.Equals(StudyStatusEnum.OnlineLossy))
{
if (location.IsLatestArchiveLossless)
{
string message = String.Format("Study has been archived as lossless and is currently lossy. It must be restored first");
throw new InvalidStudyStateOperationException(message);
}
}
Study study = location.LoadStudy(ctx);
// Unlock first.
ILockStudy lockStudy = ctx.GetBroker<ILockStudy>();
LockStudyParameters lockParms = new LockStudyParameters();
lockParms.StudyStorageKey = location.Key;
lockParms.QueueStudyStateEnum = QueueStudyStateEnum.Idle;
if (!lockStudy.Execute(lockParms) || !lockParms.Successful)
{
// Note: according to the stored proc, setting study state to Idle always succeeds so
// this will never happen
return null;
}
// Now relock into ReprocessScheduled state. If another process locks the study before this occurs,
//
lockParms.QueueStudyStateEnum = QueueStudyStateEnum.ReprocessScheduled;
if (!lockStudy.Execute(lockParms) || !lockParms.Successful)
{
throw new InvalidStudyStateOperationException(lockParms.FailureReason);
}
InsertWorkQueueParameters columns = new InsertWorkQueueParameters();
columns.ScheduledTime = scheduleTime;
columns.ServerPartitionKey = location.ServerPartitionKey;
columns.StudyStorageKey = location.Key;
columns.WorkQueueTypeEnum = WorkQueueTypeEnum.ReprocessStudy;
ReprocessStudyQueueData queueData = new ReprocessStudyQueueData();
queueData.State = new ReprocessStudyState();
queueData.State.ExecuteAtLeastOnce = false;
queueData.ChangeLog = new ReprocessStudyChangeLog();
queueData.ChangeLog.Reason = reason;
queueData.ChangeLog.TimeStamp = Platform.Time;
queueData.ChangeLog.User = (Thread.CurrentPrincipal is CustomPrincipal)
? (Thread.CurrentPrincipal as CustomPrincipal).Identity.Name
: String.Empty;
if (additionalPaths != null)
queueData.AdditionalFiles = additionalPaths.ConvertAll<string>(path => path.ToString());
columns.WorkQueueData = XmlUtils.SerializeAsXmlDoc(queueData);
IInsertWorkQueue insertBroker = ctx.GetBroker<IInsertWorkQueue>();
WorkQueue reprocessEntry = insertBroker.FindOne(columns);
if (reprocessEntry != null)
{
if (study != null)
{
Platform.Log(LogLevel.Info,
"Study Reprocess Scheduled for Study {0}, A#: {1}, Patient: {2}, ID={3}",
study.StudyInstanceUid, study.AccessionNumber, study.PatientsName, study.PatientId);
}
else
{
Platform.Log(LogLevel.Info, "Study Reprocess Scheduled for Study {0}.", location.StudyInstanceUid);
}
}
return reprocessEntry;
}