Sfoglia il codice sorgente

Use ctkXnatResource for types which directly use xnat:abstractResource.

Sascha Zelzer 10 anni fa
parent
commit
78e8ad877b

+ 0 - 3
Libs/XNAT/Core/CMakeLists.txt

@@ -20,14 +20,11 @@ set(KIT_SRCS
   ctkXnatProject.cpp
   ctkXnatReconstruction.cpp
   ctkXnatReconstructionFolder.cpp
-  ctkXnatReconstructionResource.cpp
   ctkXnatResource.cpp
   ctkXnatScan.cpp
   ctkXnatScanFolder.cpp
-  ctkXnatScanResource.cpp
   ctkXnatAssessor.cpp
   ctkXnatAssessorFolder.cpp
-  ctkXnatAssessorResource.cpp
   ctkXnatSession.cpp
   ctkXnatSettings.cpp
   ctkXnatSubject.cpp

+ 2 - 37
Libs/XNAT/Core/ctkXnatAssessor.cpp

@@ -26,8 +26,6 @@
 #include "ctkXnatObjectPrivate.h"
 #include "ctkXnatDefaultSchemaTypes.h"
 
-#include "ctkXnatAssessorResource.h"
-#include "ctkXnatScanResource.h"
 
 //----------------------------------------------------------------------------
 class ctkXnatAssessorPrivate : public ctkXnatObjectPrivate
@@ -74,39 +72,6 @@ void ctkXnatAssessor::reset()
 //----------------------------------------------------------------------------
 void ctkXnatAssessor::fetchImpl()
 {
-  QString assessorResourcesUri = this->resourceUri() + "/resources";
-  ctkXnatSession* const session = this->session();
-  QUuid queryId = session->httpGet(assessorResourcesUri);
-
-  QList<ctkXnatObject*> assessorResources = session->httpResults(queryId,
-                                                             ctkXnatDefaultSchemaTypes::XSI_ASSESSOR_RESOURCE);
-
-  foreach (ctkXnatObject* assessorResource, assessorResources)
-  {
-    QString resource_id = assessorResource->property("xnat_abstractresource_id");
-    QString label = assessorResource->property("label");
-    
-    if (!resource_id.isEmpty())
-      assessorResource->setProperty("ID", resource_id);
-    
-    this->add(assessorResource);
-  }
-  
-  assessorResourcesUri = this->resourceUri() + "/out/resources";
-  queryId = session->httpGet(assessorResourcesUri);
-
-  assessorResources = session->httpResults(queryId,
-					   ctkXnatDefaultSchemaTypes::XSI_ASSESSOR_RESOURCE);
-
-  foreach (ctkXnatObject* assessorResource, assessorResources)
-  {
-    QString resource_id = assessorResource->property("xnat_abstractresource_id");
-    QString label = assessorResource->property("label");
-    
-    if (!resource_id.isEmpty())
-      assessorResource->setProperty("ID", resource_id);
-    
-    this->add(assessorResource);
-  }
-  
+  this->fetchResources();
+  this->fetchResources("/out/resources");
 }

+ 0 - 96
Libs/XNAT/Core/ctkXnatAssessorResource.cpp

@@ -1,96 +0,0 @@
-/*=============================================================================
-
-  Library: XNAT/Core
-
-  Copyright (c) University College London,
-    Centre for Medical Image Computing
-
-  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
-
-  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.
-
-=============================================================================*/
-
-#include "ctkXnatAssessorResource.h"
-
-#include "ctkXnatSession.h"
-#include "ctkXnatObjectPrivate.h"
-#include "ctkXnatDefaultSchemaTypes.h"
-
-//----------------------------------------------------------------------------
-class ctkXnatAssessorResourcePrivate : public ctkXnatObjectPrivate
-{
-public:
-
-  ctkXnatAssessorResourcePrivate()
-  : ctkXnatObjectPrivate()
-  {
-  }
-
-  void reset()
-  {
-  }
-
-};
-
-
-//----------------------------------------------------------------------------
-ctkXnatAssessorResource::ctkXnatAssessorResource(ctkXnatObject* parent, const QString& schemaType)
-: ctkXnatObject(*new ctkXnatAssessorResourcePrivate(), parent, schemaType)
-{  
-}
-
-//----------------------------------------------------------------------------
-ctkXnatAssessorResource::~ctkXnatAssessorResource()
-{
-}
-
-//----------------------------------------------------------------------------
-QString ctkXnatAssessorResource::resourceUri() const
-{  
-  return QString("%1/out/resources/%2").arg(parent()->resourceUri(), this->id());
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatAssessorResource::reset()
-{
-  ctkXnatObject::reset();
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatAssessorResource::fetchImpl()
-{
-    
-  QString assessorResourceFilesUri = this->resourceUri() + "/files";
-  ctkXnatSession* const session = this->session();
-  QUuid queryId = session->httpGet(assessorResourceFilesUri);
-
-  
-  QList<ctkXnatObject*> files = session->httpResults(queryId,
-                                                     ctkXnatDefaultSchemaTypes::XSI_FILE);
-
-  foreach (ctkXnatObject* file, files)
-  {
-    QString label = file->property("Name");    
-    if (!label.isEmpty())
-    {
-      file->setProperty("label", label);
-      file->setProperty("ID", label);
-    }
-    this->add(file);
-  }
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatAssessorResource::download(const QString& filename)
-{
-  this->session()->download(this, filename);
-}

+ 0 - 60
Libs/XNAT/Core/ctkXnatAssessorResource.h

@@ -1,60 +0,0 @@
-/*=============================================================================
-
-  Library: XNAT/Core
-
-  Copyright (c) University College London,
-    Centre for Medical Image Computing
-
-  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
-
-  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 ctkXnatAssessorResource_h
-#define ctkXnatAssessorResource_h
-
-#include "ctkXNATCoreExport.h"
-
-#include "ctkXnatObject.h"
-#include "ctkXnatDefaultSchemaTypes.h"
-
-class ctkXnatAssessorResourcePrivate;
-
-/**
- * @ingroup XNAT_Core
- */
-class CTK_XNAT_CORE_EXPORT ctkXnatAssessorResource : public ctkXnatObject
-{
-
-public:
-
-  ctkXnatAssessorResource(ctkXnatObject* parent = 0,
-                      const QString& schemaType = ctkXnatDefaultSchemaTypes::XSI_ASSESSOR_RESOURCE);
-
-  virtual ~ctkXnatAssessorResource();
-
-  QString resourceUri() const;
-
-  void reset();
-
-  void download(const QString& filename);
-
-private:
-
-  friend class qRestResult;
-  virtual void fetchImpl();
-
-  Q_DECLARE_PRIVATE(ctkXnatAssessorResource)
-
-};
-
-#endif

+ 0 - 3
Libs/XNAT/Core/ctkXnatDefaultSchemaTypes.cpp

@@ -25,10 +25,7 @@ QString ctkXnatDefaultSchemaTypes::XSI_PROJECT = "xnat:projectData";
 QString ctkXnatDefaultSchemaTypes::XSI_SUBJECT = "xnat:subjectData";
 QString ctkXnatDefaultSchemaTypes::XSI_EXPERIMENT = "xnat:experimentData";
 QString ctkXnatDefaultSchemaTypes::XSI_SCAN = "xnat:imageScanData";
-QString ctkXnatDefaultSchemaTypes::XSI_SCAN_RESOURCE = "xnat:scanResource";
 QString ctkXnatDefaultSchemaTypes::XSI_ASSESSOR = "xnat:imageAssessorData";
-QString ctkXnatDefaultSchemaTypes::XSI_ASSESSOR_RESOURCE = "xnat:assessorResource";
 QString ctkXnatDefaultSchemaTypes::XSI_FILE = "xnat:abstractResource";
 QString ctkXnatDefaultSchemaTypes::XSI_RECONSTRUCTION = "xnat:reconstructedImageData";
-QString ctkXnatDefaultSchemaTypes::XSI_RECONSTRUCTION_RESOURCE = "xnat:reconstructionResource";
 QString ctkXnatDefaultSchemaTypes::XSI_RESOURCE = "xnat:resource";

+ 0 - 3
Libs/XNAT/Core/ctkXnatDefaultSchemaTypes.h

@@ -35,12 +35,9 @@ struct CTK_XNAT_CORE_EXPORT ctkXnatDefaultSchemaTypes
   static QString XSI_SUBJECT; // = "xnat:subjectData"
   static QString XSI_EXPERIMENT; // = "xnat:experimentData"
   static QString XSI_SCAN; // = "xnat:imageScanData"
-  static QString XSI_SCAN_RESOURCE; // = "xnat:scanResource"
   static QString XSI_ASSESSOR; // = "xnat:imageAssessorData"
-  static QString XSI_ASSESSOR_RESOURCE; // = "xnat:assessorResource"
   static QString XSI_FILE; // = "xnat:abstractResource"
   static QString XSI_RECONSTRUCTION; // = "xnat:reconstructedImageData"
-  static QString XSI_RECONSTRUCTION_RESOURCE; // = "xnat:reconstructionResource"
   static QString XSI_RESOURCE; // = "xnat:resource"
 };
 

+ 0 - 1
Libs/XNAT/Core/ctkXnatListModel.cpp

@@ -26,7 +26,6 @@
 #include "ctkXnatExperiment.h"
 #include "ctkXnatScanFolder.h"
 #include "ctkXnatScan.h"
-#include "ctkXnatScanResource.h"
 
 #include <iostream>
 #include <typeinfo>

+ 6 - 4
Libs/XNAT/Core/ctkXnatObject.cpp

@@ -312,9 +312,9 @@ void ctkXnatObject::save()
 }
 
 //----------------------------------------------------------------------------
-void ctkXnatObject::fetchResources()
+void ctkXnatObject::fetchResources(const QString& path)
 {
-  QString query = this->resourceUri() + "/resources";
+  QString query = this->resourceUri() + path;
   ctkXnatSession* const session = this->session();
   QUuid queryId = session->httpGet(query);
 
@@ -324,10 +324,12 @@ void ctkXnatObject::fetchResources()
   foreach (ctkXnatObject* resource, resources)
   {
     QString label = resource->property("label");
-    if (!label.isEmpty())
+    if (label.isEmpty())
     {
-      resource->setProperty("ID", label);
+      label = "NO NAME";
     }
+
+    resource->setProperty("label", label);
     this->add(resource);
   }
 }

+ 3 - 3
Libs/XNAT/Core/ctkXnatObject.h

@@ -126,9 +126,6 @@ public:
   /// Deletes the object on the XNAT server and removes it from its parent.
   void erase();
 
-  /// Fetches the resources of the object
-  virtual void fetchResources();
-
   virtual void download(const QString&);
   virtual void upload(const QString&);
 
@@ -161,6 +158,9 @@ protected:
   /// that stores the current object.
   ctkXnatSession* session() const;
 
+  /// Fetches the resources of the object
+  virtual void fetchResources(const QString &path = "/resources");
+
   /// The private implementation part of the object.
   const QScopedPointer<ctkXnatObjectPrivate> d_ptr;
 

+ 0 - 1
Libs/XNAT/Core/ctkXnatReconstruction.cpp

@@ -24,7 +24,6 @@
 #include "ctkXnatSession.h"
 #include "ctkXnatObjectPrivate.h"
 #include "ctkXnatReconstructionFolder.h"
-#include "ctkXnatReconstructionResource.h"
 #include "ctkXnatDefaultSchemaTypes.h"
 
 

+ 0 - 98
Libs/XNAT/Core/ctkXnatReconstructionResource.cpp

@@ -1,98 +0,0 @@
-/*=============================================================================
-
-  Library: XNAT/Core
-
-  Copyright (c) University College London,
-    Centre for Medical Image Computing
-
-  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
-
-  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.
-
-=============================================================================*/
-
-#include "ctkXnatReconstructionResource.h"
-
-#include "ctkXnatSession.h"
-#include "ctkXnatObjectPrivate.h"
-#include "ctkXnatReconstruction.h"
-#include "ctkXnatDefaultSchemaTypes.h"
-
-
-//----------------------------------------------------------------------------
-class ctkXnatReconstructionResourcePrivate : public ctkXnatObjectPrivate
-{
-public:
-
-  ctkXnatReconstructionResourcePrivate()
-  : ctkXnatObjectPrivate()
-  {
-  }
-
-  void reset()
-  {
-//    uri.clear();
-  }
-
-//  QString uri;
-};
-
-
-//----------------------------------------------------------------------------
-ctkXnatReconstructionResource::ctkXnatReconstructionResource(ctkXnatObject* parent, const QString& schemaType)
-: ctkXnatObject(*new ctkXnatReconstructionResourcePrivate(), parent, schemaType)
-{
-}
-
-//----------------------------------------------------------------------------
-ctkXnatReconstructionResource::~ctkXnatReconstructionResource()
-{
-}
-
-//----------------------------------------------------------------------------
-QString ctkXnatReconstructionResource::resourceUri() const
-{
-  return QString("%1/resources/%2").arg(parent()->resourceUri(), this->property("label"));
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatReconstructionResource::reset()
-{
-  ctkXnatObject::reset();
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatReconstructionResource::fetchImpl()
-{
-  QString reconstructionResourceFilesUri = this->resourceUri() + "/files";
-  ctkXnatSession* const session = this->session();
-  QUuid queryId = session->httpGet(reconstructionResourceFilesUri);
-
-  QList<ctkXnatObject*> files = session->httpResults(queryId,
-                                                     ctkXnatDefaultSchemaTypes::XSI_FILE);
-
-  foreach (ctkXnatObject* file, files)
-  {
-    QString label = file->property("Name");
-    if (label.isEmpty())
-    {
-      file->setProperty("ID", label);
-    }
-
-    this->add(file);
-  }
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatReconstructionResource::download(const QString& filename)
-{
-  this->session()->download(this, filename);
-}

+ 0 - 62
Libs/XNAT/Core/ctkXnatReconstructionResource.h

@@ -1,62 +0,0 @@
-/*=============================================================================
-
-  Library: XNAT/Core
-
-  Copyright (c) University College London,
-    Centre for Medical Image Computing
-
-  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
-
-  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 ctkXnatReconstructionResource_h
-#define ctkXnatReconstructionResource_h
-
-#include "ctkXNATCoreExport.h"
-
-#include "ctkXnatObject.h"
-#include "ctkXnatDefaultSchemaTypes.h"
-
-class ctkXnatConnection;
-class ctkXnatReconstructionResourcePrivate;
-class ctkXnatReconstruction;
-
-/**
- * @ingroup XNAT_Core
- */
-class CTK_XNAT_CORE_EXPORT ctkXnatReconstructionResource : public ctkXnatObject
-{
-
-public:
-
-  ctkXnatReconstructionResource(ctkXnatObject* parent = 0,
-                                const QString& schemaType = ctkXnatDefaultSchemaTypes::XSI_RECONSTRUCTION_RESOURCE);
-
-  virtual ~ctkXnatReconstructionResource();
-
-  virtual QString resourceUri() const;
-
-  void reset();
-
-  void download(const QString& filename);
-
-private:
-
-  friend class qRestResult;
-  virtual void fetchImpl();
-
-  Q_DECLARE_PRIVATE(ctkXnatReconstructionResource)
-
-};
-
-#endif

+ 4 - 3
Libs/XNAT/Core/ctkXnatResource.cpp

@@ -51,7 +51,7 @@ ctkXnatResource::~ctkXnatResource()
 //----------------------------------------------------------------------------
 QString ctkXnatResource::resourceUri() const
 {
-  return QString("%1/resources/%2").arg(parent()->resourceUri(), this->property("label"));
+  return QString("%1/resources/%2").arg(parent()->resourceUri(), this->property("xnat_abstractresource_id"));
 }
 
 //----------------------------------------------------------------------------
@@ -73,10 +73,11 @@ void ctkXnatResource::fetchImpl()
   foreach (ctkXnatObject* file, files)
   {
     QString label = file->property("Name");
-    if (!label.isEmpty())
+    if (label.isEmpty())
     {
-      file->setProperty("ID", label);
+      label = "NO NAME";
     }
+    file->setProperty("label", label);
     this->add(file);
   }
 }

+ 1 - 15
Libs/XNAT/Core/ctkXnatScan.cpp

@@ -23,7 +23,6 @@
 
 #include "ctkXnatSession.h"
 #include "ctkXnatScanFolder.h"
-#include "ctkXnatScanResource.h"
 #include "ctkXnatObject.h"
 #include "ctkXnatObjectPrivate.h"
 #include "ctkXnatDefaultSchemaTypes.h"
@@ -73,18 +72,5 @@ void ctkXnatScan::reset()
 //----------------------------------------------------------------------------
 void ctkXnatScan::fetchImpl()
 {
-  QString scanResourcesUri = this->resourceUri() + "/resources";
-  ctkXnatSession* const session = this->session();
-  QUuid queryId = session->httpGet(scanResourcesUri);
-
-  QList<ctkXnatObject*> scanResources = session->httpResults(queryId,
-                                                             ctkXnatDefaultSchemaTypes::XSI_SCAN_RESOURCE);
-
-  foreach (ctkXnatObject* scanResource, scanResources)
-  {
-    QString label = scanResource->property("label");
-    if (!label.isEmpty())
-      scanResource->setProperty("ID", label);
-    this->add(scanResource);
-  }
+  this->fetchResources();
 }

+ 0 - 99
Libs/XNAT/Core/ctkXnatScanResource.cpp

@@ -1,99 +0,0 @@
-/*=============================================================================
-
-  Library: XNAT/Core
-
-  Copyright (c) University College London,
-    Centre for Medical Image Computing
-
-  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
-
-  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.
-
-=============================================================================*/
-
-#include "ctkXnatScanResource.h"
-
-#include "ctkXnatSession.h"
-#include "ctkXnatObjectPrivate.h"
-#include "ctkXnatScan.h"
-#include "ctkXnatDefaultSchemaTypes.h"
-
-
-//----------------------------------------------------------------------------
-class ctkXnatScanResourcePrivate : public ctkXnatObjectPrivate
-{
-public:
-
-  ctkXnatScanResourcePrivate()
-  : ctkXnatObjectPrivate()
-  {
-  }
-
-  void reset()
-  {
-//    uri.clear();
-  }
-
-//  QString uri;
-};
-
-
-//----------------------------------------------------------------------------
-ctkXnatScanResource::ctkXnatScanResource(ctkXnatObject* parent, const QString& schemaType)
-: ctkXnatObject(*new ctkXnatScanResourcePrivate(), parent, schemaType)
-{
-}
-
-//----------------------------------------------------------------------------
-ctkXnatScanResource::~ctkXnatScanResource()
-{
-}
-
-//----------------------------------------------------------------------------
-QString ctkXnatScanResource::resourceUri() const
-{
-  return QString("%1/resources/%2").arg(parent()->resourceUri(), this->id ());
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatScanResource::reset()
-{
-  ctkXnatObject::reset();
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatScanResource::fetchImpl()
-{
-  QString scanResourceFilesUri = this->resourceUri() + "/files";
-  ctkXnatSession* const session = this->session();
-  QUuid queryId = session->httpGet(scanResourceFilesUri);
-
-  QList<ctkXnatObject*> files = session->httpResults(queryId,
-                                                     ctkXnatDefaultSchemaTypes::XSI_FILE);
-
-  foreach (ctkXnatObject* file, files)
-  {
-    QString label = file->property("Name");
-    if (!label.isEmpty())
-    {
-      file->setProperty("label", label);
-      file->setProperty("ID", label);
-    }
-    
-    this->add(file);
-  }
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatScanResource::download(const QString& filename)
-{
-  this->session()->download(this, filename);
-}

+ 0 - 62
Libs/XNAT/Core/ctkXnatScanResource.h

@@ -1,62 +0,0 @@
-/*=============================================================================
-
-  Library: XNAT/Core
-
-  Copyright (c) University College London,
-    Centre for Medical Image Computing
-
-  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
-
-  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 ctkXnatScanResource_h
-#define ctkXnatScanResource_h
-
-#include "ctkXNATCoreExport.h"
-
-#include "ctkXnatObject.h"
-#include "ctkXnatDefaultSchemaTypes.h"
-
-class ctkXnatConnection;
-class ctkXnatScan;
-class ctkXnatScanResourcePrivate;
-
-/**
- * @ingroup XNAT_Core
- */
-class CTK_XNAT_CORE_EXPORT ctkXnatScanResource : public ctkXnatObject
-{
-
-public:
-
-  ctkXnatScanResource(ctkXnatObject* parent = 0,
-                      const QString& schemaType = ctkXnatDefaultSchemaTypes::XSI_SCAN_RESOURCE);
-
-  virtual ~ctkXnatScanResource();
-
-  QString resourceUri() const;
-
-  void reset();
-
-  void download(const QString& filename);
-
-private:
-
-  friend class qRestResult;
-  virtual void fetchImpl();
-
-  Q_DECLARE_PRIVATE(ctkXnatScanResource)
-
-};
-
-#endif

+ 6 - 33
Libs/XNAT/Core/ctkXnatSession.cpp

@@ -29,12 +29,9 @@
 #include "ctkXnatObject.h"
 #include "ctkXnatProject.h"
 #include "ctkXnatReconstruction.h"
-#include "ctkXnatReconstructionResource.h"
 #include "ctkXnatResource.h"
 #include "ctkXnatScan.h"
-#include "ctkXnatScanResource.h"
 #include "ctkXnatAssessor.h"
-#include "ctkXnatAssessorResource.h"
 #include "ctkXnatSubject.h"
 #include "ctkXnatDefaultSchemaTypes.h"
 
@@ -253,7 +250,10 @@ QList<ctkXnatObject*> ctkXnatSessionPrivate::results(qRestResult* restResult, QS
     // Fall back. Create the default class according to the default schema type
     if (!typeId)
     {
-      qWarning() << QString("No ctkXnatObject sub-class registered for the schema %1. Falling back to the default class %2.").arg(customSchemaType).arg(schemaType);
+      if (!customSchemaType.isEmpty())
+      {
+        qWarning() << QString("No ctkXnatObject sub-class registered for the schema %1. Falling back to the default class %2.").arg(customSchemaType).arg(schemaType);
+      }
       typeId = QMetaType::type(qPrintable(schemaType));
     }
 
@@ -322,11 +322,8 @@ ctkXnatSession::ctkXnatSession(const ctkXnatLoginProfile& loginProfile)
   qRegisterMetaType<ctkXnatExperiment>(qPrintable(ctkXnatDefaultSchemaTypes::XSI_EXPERIMENT));
   qRegisterMetaType<ctkXnatScan>(qPrintable(ctkXnatDefaultSchemaTypes::XSI_SCAN));
   qRegisterMetaType<ctkXnatReconstruction>(qPrintable(ctkXnatDefaultSchemaTypes::XSI_RECONSTRUCTION));
-  qRegisterMetaType<ctkXnatScanResource>(qPrintable(ctkXnatDefaultSchemaTypes::XSI_SCAN_RESOURCE));
-  qRegisterMetaType<ctkXnatReconstructionResource>(qPrintable(ctkXnatDefaultSchemaTypes::XSI_RECONSTRUCTION_RESOURCE));
   qRegisterMetaType<ctkXnatResource>(qPrintable(ctkXnatDefaultSchemaTypes::XSI_RESOURCE));
   qRegisterMetaType<ctkXnatAssessor>(qPrintable(ctkXnatDefaultSchemaTypes::XSI_ASSESSOR));
-  qRegisterMetaType<ctkXnatAssessorResource>(qPrintable(ctkXnatDefaultSchemaTypes::XSI_ASSESSOR_RESOURCE));
   qRegisterMetaType<ctkXnatFile>(qPrintable(ctkXnatDefaultSchemaTypes::XSI_FILE));
   
   QString url = d->loginProfile.serverUrl().toString();
@@ -602,35 +599,11 @@ void ctkXnatSession::download(ctkXnatFile* file, const QString& fileName)
 }
 
 //----------------------------------------------------------------------------
-void ctkXnatSession::download(ctkXnatScanResource* scanResource, const QString& fileName)
-{
-  Q_D(ctkXnatSession);
-
-  QString query = scanResource->resourceUri() + "/files";
-  qRestAPI::Parameters parameters;
-  parameters["format"] = "zip";
-  QUuid queryId = d->xnat->download(fileName, query, parameters);
-  d->xnat->sync(queryId);
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatSession::download(ctkXnatAssessorResource* assessorResource, const QString& fileName)
-{
-  Q_D(ctkXnatSession);
-
-  QString query = assessorResource->resourceUri() + "/files";
-  qRestAPI::Parameters parameters;
-  parameters["format"] = "zip";
-  QUuid queryId = d->xnat->download(fileName, query, parameters);
-  d->xnat->sync(queryId);
-}
-
-//----------------------------------------------------------------------------
-void ctkXnatSession::download(ctkXnatReconstructionResource* reconstructionResource, const QString& fileName)
+void ctkXnatSession::download(ctkXnatResource* resource, const QString& fileName)
 {
   Q_D(ctkXnatSession);
 
-  QString query = reconstructionResource->resourceUri() + "/files";
+  QString query = resource->resourceUri() + "/files";
   qRestAPI::Parameters parameters;
   parameters["format"] = "zip";
   QUuid queryId = d->xnat->download(fileName, query, parameters);

+ 2 - 6
Libs/XNAT/Core/ctkXnatSession.h

@@ -39,9 +39,7 @@ class ctkXnatFile;
 class ctkXnatLoginProfile;
 class ctkXnatDataModel;
 class ctkXnatObject;
-class ctkXnatScanResource;
-class ctkXnatReconstructionResource;
-class ctkXnatAssessorResource;
+class ctkXnatResource;
 
 /**
  * @ingroup XNAT_Core
@@ -196,9 +194,7 @@ public:
 
 //  void download(ctkXnatScan* scan, const QString& zipFileName);
 
-  void download(ctkXnatScanResource* scanResource, const QString& zipFileName);
-  void download(ctkXnatReconstructionResource* reconstructionResource, const QString& zipFileName);
-  void download(ctkXnatAssessorResource* assessorResource, const QString& zipFileName);
+  void download(ctkXnatResource* resource, const QString& zipFileName);
 
   /**
    * @brief Sends a http HEAD request to the xnat instance