瀏覽代碼

Merge branch 'master' of github.com:pieper/CTK

Julien Finet 15 年之前
父節點
當前提交
5dd463e77a

+ 18 - 0
CMakeLists.txt

@@ -65,6 +65,24 @@ IF(BUILD_TESTING)
     ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake
     @ONLY
     )
+
+  # Configuration for the CMake-generated test driver
+  SET(CMAKE_TESTDRIVER_EXTRA_INCLUDES "#include <stdexcept>")
+  SET(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "
+    try
+      {")
+  SET(CMAKE_TESTDRIVER_AFTER_TESTMAIN "    }
+      catch( std::exception & excp )
+        {
+        fprintf(stderr,\"%s\\n\",excp.what());
+        return EXIT_FAILURE;
+        }
+      catch( ... )
+        {
+        printf(\"Exception caught in the test driver\\n\");
+        return EXIT_FAILURE;
+        }
+      ")
 ENDIF()
 
 #-----------------------------------------------------------------------------

+ 3 - 2
Libs/Core/CMakeLists.txt

@@ -28,8 +28,9 @@ SET(KIT_UI_FORMS
 SET(KIT_resources
 )
 
-# Additional Target libraries (QT libs already included)
+# Additional Target libraries
 SET(KIT_target_libraries
+  ${QT_LIBRARIES}
   )
 
 ctk_build_qtlib(
@@ -49,5 +50,5 @@ ctk_build_qtlib(
 
 # Testing
 IF(BUILD_TESTING)
-  #ADD_SUBDIRECTORY(Testing)
+  ADD_SUBDIRECTORY(Testing)
 ENDIF(BUILD_TESTING)

+ 29 - 0
Libs/Core/Testing/CMakeLists.txt

@@ -0,0 +1,29 @@
+SET(KIT CTKCore)
+
+CREATE_TEST_SOURCELIST(Tests ${KIT}CxxTests.cxx
+  qCTKUtilsTest1.cxx
+  #EXTRA_INCLUDE TestingMacros.h
+  )
+
+SET (TestsToRun ${Tests})
+REMOVE (TestsToRun ${KIT}CxxTests.cxx)
+
+SET(LIBRARY_NAME ${PROJECT_NAME})
+
+ADD_EXECUTABLE(${KIT}CxxTests ${Tests})
+TARGET_LINK_LIBRARIES(${KIT}CxxTests ${LIBRARY_NAME})
+
+SET( KIT_TESTS ${CXX_TEST_PATH}/${KIT}CxxTests)
+IF(WIN32)
+  SET(KIT_TESTS ${CXX_TEST_PATH}/${CMAKE_BUILD_TYPE}/${KIT}CxxTests)
+ENDIF(WIN32)
+
+MACRO( SIMPLE_TEST  TESTNAME )
+  ADD_TEST( ${TESTNAME} ${LAUNCH_EXE} ${KIT_TESTS} ${TESTNAME} )
+ENDMACRO( SIMPLE_TEST  )
+
+#
+# Add Tests
+#
+
+SIMPLE_TEST( qCTKUtilsTest1 )

+ 134 - 0
Libs/Core/Testing/qCTKUtilsTest1.cxx

@@ -0,0 +1,134 @@
+/*=========================================================================
+
+  Library:   qCTK
+
+  Copyright (c) Kitware Inc. 
+  All rights reserved.
+  Distributed under a BSD License. See LICENSE.txt file.
+
+  This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the above copyright notice for more information.
+
+=========================================================================*/
+
+// qCTK includes
+#include "qCTKUtils.h"
+
+// QT includes
+#include <QStringList>
+
+// STD includes
+#include <stdlib.h>
+#include <iostream>
+#include <string>
+#include <vector>
+
+int qCTKUtilsTest1(int argc, char * argv [] )
+{
+  Q_UNUSED(argc);
+  Q_UNUSED(argv);  
+
+  // Test qListToSTLVector(const QStringList& list, std::vector<char*>& vector)
+  
+  QStringList inputStringList;
+  inputStringList << "Testing";
+  inputStringList << " is ";
+  inputStringList << "awesome !";
+
+  std::vector<char*> outputCharVector;
+  
+  qCTKUtils::qListToSTLVector(inputStringList, outputCharVector);
+
+  if (outputCharVector.size() != 3)
+    {
+    std::cerr << "Error in qListToSTLVector(const QStringList&, std::vector<char*>&)" << std::endl
+              << "outputCharVector should contains 3 elements." << std::endl;
+    return EXIT_FAILURE;
+    }
+  
+  if ((strcmp(outputCharVector[0], "Testing") != 0) ||
+      (strcmp(outputCharVector[1], " is ") != 0) ||
+      (strcmp(outputCharVector[2], "awesome !") != 0))
+    {
+    std::cerr << "Error in qListToSTLVector(const QStringList&, std::vector<char*>&)" << std::endl
+              << "Content of outputCharVector is incorrect" << std::endl
+              << "inputStringList[0] => [" << qPrintable(inputStringList[0]) << "]" << std::endl
+              << "inputStringList[1] => [" << qPrintable(inputStringList[1]) << "]" << std::endl
+              << "inputStringList[2] => [" << qPrintable(inputStringList[2]) << "]" << std::endl
+              << "outputCharVector[0] => [" << outputCharVector[0] << "]" << std::endl
+              << "outputCharVector[1] => [" << outputCharVector[1] << "]" << std::endl
+              << "outputCharVector[2] => [" << outputCharVector[2] << "]" << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  delete [] outputCharVector[0];
+  delete [] outputCharVector[1];
+  delete [] outputCharVector[2]; 
+
+  
+  
+  // Test qListToSTLVector(const QStringList& list, std::vector<std::string>& vector)
+
+  std::vector<std::string> outputStringVector;
+
+  qCTKUtils::qListToSTLVector(inputStringList, outputStringVector);
+
+  if (outputStringVector.size() != 3)
+    {
+    std::cerr << "Error in qListToSTLVector(const QStringList&, std::vector<std::string>&)" << std::endl
+              << "outputStringVector should contains 3 elements." << std::endl;
+    return EXIT_FAILURE;
+    }  
+
+  if ((outputStringVector[0].compare("Testing") != 0) ||
+      (outputStringVector[1].compare(" is ") != 0) ||
+      (outputStringVector[2].compare("awesome !") != 0))
+    {
+    std::cerr << "Error in qListToSTLVector(const QStringList&, std::vector<std::string>&)" << std::endl
+              << "Content of outputStringVector is incorrect" << std::endl
+              << "inputStringList[0] => [" << qPrintable(inputStringList[0]) << "]" << std::endl
+              << "inputStringList[1] => [" << qPrintable(inputStringList[1]) << "]" << std::endl
+              << "inputStringList[2] => [" << qPrintable(inputStringList[2]) << "]" << std::endl
+              << "outputStringVector[0] => [" << outputStringVector[0] << "]" << std::endl
+              << "outputStringVector[1] => [" << outputStringVector[1] << "]" << std::endl
+              << "outputStringVector[2] => [" << outputStringVector[2] << "]" << std::endl;
+    return EXIT_FAILURE;
+    }
+
+
+  // Test stlVectorToQList(const std::vector<std::string>& vector, QStringList& list)
+  
+  std::vector<std::string> inputStringVector;
+  inputStringVector.push_back("Testing");
+  inputStringVector.push_back(" is ");
+  inputStringVector.push_back("awesome !");
+
+  QStringList ouputStringList;
+
+  qCTKUtils::stlVectorToQList(inputStringVector, ouputStringList);
+
+  if (ouputStringList.size() != 3)
+    {
+    std::cerr << "Error in stlVectorToQList(const std::vector<std::string>&, QStringList&)" << std::endl
+              << "ouputStringList should contains 3 elements." << std::endl;
+    return EXIT_FAILURE;
+    }
+    
+  if ((ouputStringList[0] != QLatin1String("Testing")) ||
+      (ouputStringList[1] != QLatin1String(" is ")) ||
+      (ouputStringList[2] != QLatin1String("awesome !")))
+    {
+    std::cerr << "Error in stlVectorToQList(const std::vector<std::string>&, QStringList&)" << std::endl
+              << "Content of ouputStringList is incorrect" << std::endl
+              << "inputStringVector[0] => [" << inputStringVector[0] << "]" << std::endl
+              << "inputStringVector[1] => [" << inputStringVector[1] << "]" << std::endl
+              << "inputStringVector[2] => [" << inputStringVector[2] << "]" << std::endl
+              << "ouputStringList[0] => [" << qPrintable(ouputStringList[0]) << "]" << std::endl
+              << "ouputStringList[1] => [" << qPrintable(ouputStringList[1]) << "]" << std::endl
+              << "ouputStringList[2] => [" << qPrintable(ouputStringList[2]) << "]" << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  return EXIT_SUCCESS;
+}

+ 1 - 1
Libs/DICOM/Core/CMakeLists.txt

@@ -32,7 +32,7 @@ SET(KIT_UI_FORMS
 SET(KIT_resources
 )
 
-# Additional Target libraries (QT libs already included)
+# Additional Target libraries
 SET(KIT_target_libraries
   CTKCore
   )

文件差異過大導致無法顯示
+ 2262 - 0
Libs/DICOM/Core/Resources/dicom-sample.sql


+ 50 - 0
Libs/DICOM/Core/Resources/dicom-schema.sql

@@ -0,0 +1,50 @@
+-- 
+-- A simple SQLITE3 database schema for modelling locally stored DICOM files
+-- 
+
+BEGIN TRANSACTION;
+DROP TABLE IF EXISTS 'Images' ;
+DROP TABLE IF EXISTS 'Patients' ;
+DROP TABLE IF EXISTS 'Series' ;
+DROP TABLE IF EXISTS 'Studies' ;
+
+CREATE TABLE 'Images' (
+  'Filename' VARCHAR(1024) NOT NULL ,
+  'SeriesInstanceUID' VARCHAR(255) NOT NULL ,
+  PRIMARY KEY ('Filename') );
+CREATE TABLE 'Patients' (
+  'UID' INTEGER PRIMARY KEY AUTOINCREMENT,
+  'PatientsName' VARCHAR(255) NULL ,
+  'PatientID' VARCHAR(255) NULL ,
+  'PatientsBirthDate' DATE NULL ,
+  'PatientsBirthTime' TIME NULL ,
+  'PatientsSex' varchar(1) NULL ,
+  'PatientsComments' VARCHAR(255) NULL );
+CREATE TABLE 'Series' (
+  'SeriesInstanceUID' VARCHAR(255) NOT NULL ,
+  'StudyInstanceUID' VARCHAR(45) NOT NULL ,
+  'SeriesNumber' INT NULL ,
+  'SeriesDate' DATE NULL ,
+  'SeriesTime' VARCHAR(20) NULL ,
+  'SeriesDescription' VARCHAR(255) NULL ,
+  'BodyPartExamined' VARCHAR(255) NULL ,
+  'FrameOfReferenceUID' VARCHAR(255) NULL ,
+  'AcquisitionNumber' INT NULL ,
+  'ContrastAgent' VARCHAR(255) NULL ,
+  'ScanningSequence' VARCHAR(45) NULL ,
+  'EchoNumber' INT NULL ,
+  'TemporalPosition' INT NULL ,
+  PRIMARY KEY ('SeriesInstanceUID') );
+CREATE TABLE 'Studies' (
+  'StudyInstanceUID' VARCHAR(255) NOT NULL ,
+  'PatientsUID' INT NOT NULL ,
+  'StudyID' VARCHAR(255) NULL ,
+  'StudyDate' DATE NULL ,
+  'StudyTime' VARCHAR(20) NULL ,
+  'AccessionNumber' VARCHAR(255) NULL ,
+  'ModalitiesInStudy' VARCHAR(255) NULL ,
+  'ReferringPhysician' VARCHAR(255) NULL ,
+  'StudyDescription' VARCHAR(255) NULL ,
+  PRIMARY KEY ('StudyInstanceUID') );
+COMMIT;
+

+ 5 - 0
Libs/DICOM/Core/Resources/dicom.qrc

@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/dicom">
+  <file>dicom-schema.sql</file>
+</qresource>
+</RCC>

+ 1 - 1
Libs/DICOM/Widgets/CMakeLists.txt

@@ -35,7 +35,7 @@ SET(KIT_UI_FORMS
 SET(KIT_resources
 )
 
-# Additional Target libraries (QT libs already included)
+# Additional Target libraries
 SET(KIT_target_libraries
   CTKCore
   CTKDICOMCore

+ 1 - 1
Libs/Widgets/CMakeLists.txt

@@ -29,7 +29,7 @@ SET(KIT_UI_FORMS
 SET(KIT_resources
 )
 
-# Additional Target libraries (QT libs already included)
+# Additional Target libraries
 SET(KIT_target_libraries
   CTKCore
   )