ctkXnatReconstructionFolder.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*=============================================================================
  2. Library: XNAT/Core
  3. Copyright (c) University College London,
  4. Centre for Medical Image Computing
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #include "ctkXnatReconstructionFolder.h"
  16. #include "ctkXnatSession.h"
  17. #include "ctkXnatExperiment.h"
  18. #include "ctkXnatObjectPrivate.h"
  19. #include "ctkXnatReconstruction.h"
  20. #include "ctkXnatDefaultSchemaTypes.h"
  21. //----------------------------------------------------------------------------
  22. class ctkXnatReconstructionFolderPrivate : public ctkXnatObjectPrivate
  23. {
  24. public:
  25. ctkXnatReconstructionFolderPrivate()
  26. : ctkXnatObjectPrivate()
  27. {
  28. }
  29. void reset()
  30. {
  31. // uri.clear();
  32. }
  33. // QString uri;
  34. };
  35. //----------------------------------------------------------------------------
  36. ctkXnatReconstructionFolder::ctkXnatReconstructionFolder(ctkXnatObject* parent)
  37. : ctkXnatObject(*new ctkXnatReconstructionFolderPrivate(), parent, QString::null)
  38. {
  39. this->setProperty("id", "reconstructions");
  40. }
  41. //----------------------------------------------------------------------------
  42. ctkXnatReconstructionFolder::~ctkXnatReconstructionFolder()
  43. {
  44. }
  45. //----------------------------------------------------------------------------
  46. QString ctkXnatReconstructionFolder::resourceUri() const
  47. {
  48. return QString("%1/%2").arg(parent()->resourceUri(), this->id());
  49. }
  50. //----------------------------------------------------------------------------
  51. void ctkXnatReconstructionFolder::reset()
  52. {
  53. ctkXnatObject::reset();
  54. }
  55. //----------------------------------------------------------------------------
  56. void ctkXnatReconstructionFolder::fetchImpl()
  57. {
  58. QString reconstructionsUri = this->resourceUri();
  59. ctkXnatSession* const session = this->session();
  60. QUuid queryId = session->httpGet(reconstructionsUri);
  61. QList<ctkXnatObject*> reconstructions = session->httpResults(queryId,
  62. ctkXnatDefaultSchemaTypes::XSI_RECONSTRUCTION);
  63. foreach (ctkXnatObject* reconstruction, reconstructions)
  64. {
  65. this->add(reconstruction);
  66. }
  67. }