예제 #1
0
        private void ValidateSeries(StudyStorageLocation location, Series series, SeriesXml seriesXml)
        {
            Study           study     = location.Study;
            ServerPartition partition = location.ServerPartition;

            if (seriesXml == null)
            {
                throw new StudyIntegrityValidationFailure(ValidationErrors.InconsistentObjectCount,
                                                          new ValidationStudyInfo(study, partition),
                                                          String.Format("Series {0} exists in the datbase but not in the study xml",
                                                                        series.SeriesInstanceUid));
            }

            if (series.NumberOfSeriesRelatedInstances != seriesXml.NumberOfSeriesRelatedInstances)
            {
                throw new StudyIntegrityValidationFailure(ValidationErrors.InconsistentObjectCount,
                                                          new ValidationStudyInfo(study, partition),
                                                          String.Format("Number of Series Related Instance in the database and xml for series {0} do not match: {1} vs {2}",
                                                                        series.SeriesInstanceUid, series.NumberOfSeriesRelatedInstances, seriesXml.NumberOfSeriesRelatedInstances));
            }

            long seriesImageCount = DirectoryUtility.Count(location.GetSeriesPath(series.SeriesInstanceUid), "*" + ServerPlatform.DicomFileExtension, true, null);

            if (seriesXml.NumberOfSeriesRelatedInstances != seriesImageCount)
            {
                throw new StudyIntegrityValidationFailure(ValidationErrors.InconsistentObjectCount,
                                                          new ValidationStudyInfo(study, partition),
                                                          String.Format("Number of Series Related Instance in the xml for series {0} does not match number of images in the series folder: {1} vs {2}",
                                                                        series.SeriesInstanceUid, seriesXml.NumberOfSeriesRelatedInstances, seriesImageCount));
            }
        }
        private void ValidateSeries(StudyStorageLocation location, Series series, SeriesXml seriesXml)
        {
            Study study = location.Study;
            ServerPartition partition = location.ServerPartition;

            if (seriesXml == null)
            {
                throw new StudyIntegrityValidationFailure(ValidationErrors.InconsistentObjectCount,
                                                          new ValidationStudyInfo(study, partition),
                                                          String.Format("Series {0} exists in the datbase but not in the study xml",
                                                                        series.SeriesInstanceUid));

            }

            if (series.NumberOfSeriesRelatedInstances != seriesXml.NumberOfSeriesRelatedInstances)
            {
                throw new StudyIntegrityValidationFailure(ValidationErrors.InconsistentObjectCount,
                                                          new ValidationStudyInfo(study, partition),
                                                          String.Format("Number of Series Related Instance in the database and xml for series {0} do not match: {1} vs {2}",
                                                                        series.SeriesInstanceUid, series.NumberOfSeriesRelatedInstances, seriesXml.NumberOfSeriesRelatedInstances));

            }

            long seriesImageCount = DirectoryUtility.Count(location.GetSeriesPath(series.SeriesInstanceUid), "*" + ServerPlatform.DicomFileExtension, true, null);
            if (seriesXml.NumberOfSeriesRelatedInstances != seriesImageCount)
            {
                throw new StudyIntegrityValidationFailure(ValidationErrors.InconsistentObjectCount,
                                                          new ValidationStudyInfo(study, partition),
                                                          String.Format("Number of Series Related Instance in the xml for series {0} does not match number of images in the series folder: {1} vs {2}",
                                                                        series.SeriesInstanceUid, seriesXml.NumberOfSeriesRelatedInstances, seriesImageCount));
            }

        }