<commit_before>/*=========================================================================

  Library:   CTK

  Copyright (c) Kitware Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0.txt

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

=========================================================================*/

#ifndef __ctkDICOMQuery_h
#define __ctkDICOMQuery_h

// Qt includes 
#include <QObject>
#include <QMap>
#include <QString>
#include <QSqlDatabase>

// CTK includes
#include <ctkPimpl.h>

#include "ctkDICOMCoreExport.h"
#include "ctkDICOMDatabase.h"

class ctkDICOMQueryPrivate;

/// \ingroup DICOM_Core
class CTK_DICOM_CORE_EXPORT ctkDICOMQuery : public QObject
{
  Q_OBJECT
  Q_PROPERTY(QString callingAETitle READ callingAETitle WRITE setCallingAETitle);
  Q_PROPERTY(QString calledAETitle READ calledAETitle WRITE setCallingAETitle);
  Q_PROPERTY(QString host READ host WRITE setHost);
  Q_PROPERTY(int port READ port WRITE setPort);
  Q_PROPERTY(bool preferCGET READ preferCGET WRITE setPreferCGET);

public:
  explicit ctkDICOMQuery(QObject* parent = 0);
  virtual ~ctkDICOMQuery();
  
  /// Set methods for connectivity
  /// Empty by default
  void setCallingAETitle ( const QString& callingAETitle );
  QString callingAETitle()const;
  /// Empty by default
  void setCalledAETitle ( const QString& calledAETitle );
  QString calledAETitle()const;
  /// Empty by default
  void setHost ( const QString& host );
  QString host()const;
  /// Specify a port for the packet headers.
  /// \a port ranges from 0 to 65535.
  /// 0 by default.
  void setPort ( int port );
  int port()const;
  /// Prefer CGET over CMOVE for retrieval of query results
  /// false by default
  void setPreferCGET ( bool preferCGET );
  bool preferCGET()const;

  /// Query a remote DICOM Image Store SCP
  /// You must at least set the host and port before calling query()
  bool query(ctkDICOMDatabase& database);

  /// Access the list of study instance UIDs from the last query
  QStringList studyInstanceUIDQueried()const;

  ///
  /// Filters are keyword/value pairs as generated by
  /// the ctkDICOMWidgets in a human readable (and editable)
  /// format.  The Query is responsible for converting these<commit_msg>ENH: Expose all ctkDICOMQuery methods in Python<commit_after>/*=========================================================================

  Library:   CTK

  Copyright (c) Kitware Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0.txt

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

=========================================================================*/

#ifndef __ctkDICOMQuery_h
#define __ctkDICOMQuery_h

// Qt includes 
#include <QObject>
#include <QMap>
#include <QString>
#include <QSqlDatabase>

// CTK includes
#include <ctkPimpl.h>

#include "ctkDICOMCoreExport.h"
#include "ctkDICOMDatabase.h"

class ctkDICOMQueryPrivate;

/// \ingroup DICOM_Core
class CTK_DICOM_CORE_EXPORT ctkDICOMQuery : public QObject
{
  Q_OBJECT
  Q_PROPERTY(QString callingAETitle READ callingAETitle WRITE setCallingAETitle);
  Q_PROPERTY(QString calledAETitle READ calledAETitle WRITE setCalledAETitle);
  Q_PROPERTY(QString host READ host WRITE setHost);
  Q_PROPERTY(int port READ port WRITE setPort);
  Q_PROPERTY(bool preferCGET READ preferCGET WRITE setPreferCGET);
  Q_PROPERTY(QStringList studyInstanceUIDQueried READ studyInstanceUIDQueried);
  Q_PROPERTY(QMap<QString, QVariant> filters READ filters WRITE setFilters);

public:
  explicit ctkDICOMQuery(QObject* parent = 0);
  virtual ~ctkDICOMQuery();
  
  /// Set methods for connectivity
  /// Empty by default
  void setCallingAETitle ( const QString& callingAETitle );
  QString callingAETitle()const;
  /// Empty by default
  void setCalledAETitle ( const QString& calledAETitle );
  QString calledAETitle()const;
  /// Empty by default
  void setHost ( const QString& host );
  QString host()const;
  /// Specify a port for the packet headers.
  /// \a port ranges from 0 to 65535.
  /// 0 by default.
  void setPort ( int port );
  int port()const;
  /// Prefer CGET over CMOVE for retrieval of query results
  /// false by default
  void setPreferCGET ( bool preferCGET );
  bool preferCGET()const;

  /// Query a remote DICOM Image Store SCP
  /// You must at least set the host and port before calling query()
  Q_INVOKABLE bool query(ctkDICOMDatabase& database);

  /// Access the list of study instance UIDs from the last query
  QStringList studyInstanceUIDQueried()const;

  ///
  /// Filters are keyword/value pairs as generated by
  /// the ctkDICOMWidgets in a human readable (and editable)
  /// format.  The Query is responsible for converting these
{'fraction_non_alphanumeric': 0.12531599855543518, 'fraction_numerical': 0.004333694474539545, 'mean_word_length': 4.200938967136151, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6414541', 'n_tokens_mistral': 1656, 'n_tokens_neox': 1625, 'n_words': 591}