public virtual PagedResult <DicomDataset> SearchPaged
        (
            IEnumerable <IMatchingCondition> conditions,
            IQueryOptions options,
            string queryLevel
        )
        {
            IQueryResponseBuilder      responseBuilder;
            PagedResult <DicomDataset> result;


            if (null == options || !options.Limit.HasValue || !options.Offset.HasValue)
            {
                throw new ArgumentNullException("options", "Query options must have a value for paged result");
            }

            if (options.Limit == 0)
            {
                throw new IndexOutOfRangeException("Invalid query limit for paged result");
            }

            responseBuilder = CreateResponseBuilder(queryLevel);

            var cmd = DataAdapter.CreateSelectCommand(SchemaProvider.GetQueryTable(queryLevel),
                                                      conditions,
                                                      options,
                                                      responseBuilder);

            cmd.Execute();

            result = new PagedResult <DicomDataset> (cmd.Result,
                                                     options.Offset.Value,
                                                     options.Limit.Value,
                                                     cmd.TotalCount.HasValue ? cmd.TotalCount.Value : cmd.Result.Count());

            return(result);

            /**********TODO: How to add support to ModalitiesInStudy, SeriesCountInStudies, SopInstanceCountInStudy/Series
             * if conditions.contains (ModalitiesInStudies)
             * {
             *  condition.add (series.Modality);
             *  condition.add (series.SeriesInstanceUID); //to get series count
             *  condition.add (sopInstances.SopInsanceUID); //to get instances count
             *
             *  Search
             *  series = ResponseBuilder.ResultSets[Series]
             *
             *  //Same logic for SeriesCountInStudies and InstanceCountInStudies/Series
             *  foreach ( study in studies )
             *  {
             *      var modalitiesInStudy = series.Where ( n=>n.StudyInstanceUID = study.StudyInstanceUID).Select (s=>s.Modality);
             *  }
             * }
             **********/
        }
Exemplo n.º 2
0
        public virtual IEnumerable <DicomDataset> Search
        (
            IEnumerable <IMatchingCondition> conditions,
            IQueryOptions options,
            string queryLevel
        )
        {
            IQueryResponseBuilder responseBuilder;

            responseBuilder = CreateResponseBuilder(queryLevel);

            var cmd = DataAdapter.CreateSelectCommand(SchemaProvider.GetQueryTable(queryLevel),
                                                      conditions,
                                                      options,
                                                      responseBuilder);

            cmd.Execute();

            return(cmd.Result);
        }
Exemplo n.º 3
0
        public virtual PagedResult <DicomDataset> SearchPaged
        (
            IEnumerable <IMatchingCondition> conditions,
            IQueryOptions options,
            string queryLevel
        )
        {
            IQueryResponseBuilder      responseBuilder;
            PagedResult <DicomDataset> result;


            if (null == options || !options.Limit.HasValue || !options.Offset.HasValue)
            {
                throw new ArgumentNullException("options", "Query options must have a value for paged result");
            }

            if (options.Limit == 0)
            {
                throw new IndexOutOfRangeException("Invalid query limit for paged result");
            }

            responseBuilder = CreateResponseBuilder(queryLevel);

            conditions = AddAdditionalQueryParameters(conditions, options, queryLevel);

            var cmd = DataAdapter.CreateSelectCommand(SchemaProvider.GetQueryTable(queryLevel),
                                                      conditions,
                                                      options,
                                                      responseBuilder);

            cmd.Execute();

            FillAdditionalQueryParameters(conditions, options, responseBuilder, queryLevel);

            result = new PagedResult <DicomDataset> (cmd.Result,
                                                     options.Offset.Value,
                                                     options.Limit.Value,
                                                     cmd.TotalCount.HasValue ? cmd.TotalCount.Value : cmd.Result.Count());

            return(result);
        }