diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4f0c446 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Build-VS/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..71cf31c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +################################################################################ +# +# 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. +# +################################################################################ + +cmake_minimum_required(VERSION 2.8.6) + +project(ImageViewer) + +add_subdirectory(ImageViewer) + diff --git a/ImageViewer/CMakeLists.txt b/ImageViewer/CMakeLists.txt new file mode 100644 index 0000000..2b4854a --- /dev/null +++ b/ImageViewer/CMakeLists.txt @@ -0,0 +1,41 @@ +################################################################################ +# +# 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. +# +################################################################################ + +cmake_minimum_required(VERSION 2.8.6) + +project(ImageViewer) + +find_package(CTK REQUIRED) +include(${CTK_USE_FILE}) + +find_package(CTK REQUIRED) +include(${CTK_USE_FILE}) + +find_package(Qt4 REQUIRED) +SET(QT_USE_QTMAIN TRUE) +SET(QT_USE_QTSQL TRUE) +include(${QT_USE_FILE}) + +add_executable(ImageViewer main.cpp) +target_link_libraries(ImageViewer ${QT_QTMAIN_LIBRARY} CTKWidgets CTKDICOMCore CTKDICOMWidgets CTKPluginFramework) +IF(WIN32) + set_target_properties(ImageViewer PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") + +ENDIF(WIN32) diff --git a/ImageViewer/main.cpp b/ImageViewer/main.cpp new file mode 100644 index 0000000..009caec --- /dev/null +++ b/ImageViewer/main.cpp @@ -0,0 +1,110 @@ +/*========================================================================= + + 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. + +=========================================================================*/ + +// Qt includes +#include +#include +#include + +#include +#include +#include +#include +#include +// CTK includes +#include +#include +#include +#include +#include +// ctkDICOMCore includes +#include "ctkDICOMDatabase.h" +#include "ctkDICOMModel.h" +// CTK Widgets +#include "ctkDICOMItemView.h" + +// DCMTK includes +#include +#include + + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv); + + QWidget topLevel; + QVBoxLayout* topLevelLayout = new QVBoxLayout; + + ctkCollapsibleButton buttons("Buttons"); + QFormLayout* buttonsLayout = new QFormLayout; + buttonsLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); + topLevelLayout->addWidget(&buttons); + + ctkCheckablePushButton checkablePushButton; + checkablePushButton.setText("Checkable"); + buttonsLayout->addRow("ctkCheckablePushButton", &checkablePushButton); + + ctkColorPickerButton colorPickerButton; + colorPickerButton.setColor(QColor("#9e1414")); + buttonsLayout->addRow("ctkColorPickerButton", &colorPickerButton); + + buttons.setLayout(buttonsLayout); + + ctkCollapsibleButton sliders("Sliders"); + QFormLayout* slidersLayout = new QFormLayout; + topLevelLayout->addWidget(&sliders); + + ctkRangeWidget rangeWidget; + slidersLayout->addRow("ctkRangeWidget", &rangeWidget); + + sliders.setLayout(slidersLayout); + + topLevel.setLayout(topLevelLayout); + topLevel.show(); + ctkDICOMAppWidget DICOMApp; + + QString databaseDirectory; + DICOMApp.setDatabaseDirectory(databaseDirectory); + DICOMApp.show(); + QString s; + if( QApplication::argc() > 1 ) + { + s = QApplication::argv()[1]; + } + else + { + s = QFileDialog::getOpenFileName( 0, + "Choose an image file", ".", + "DCM (*)" + ); + if( s.size() == 0 ) + { + return EXIT_SUCCESS; + } + } + + DicomImage dcmImage( s.toStdString().c_str() ); + + ctkDICOMItemView imageView; + imageView.addImage( dcmImage ); + imageView.show(); + imageView.raise(); + return app.exec(); +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..d0035b5 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +Examples +======== + +Collection of independent CMake-based projects illustrating how to build and link against CTK. + +Build Instructions +------------------ + +* First [download and build CTK](http://www.commontk.org/index.php/Build_Instructions) +``` +~/work$ git clone git://github.com/commontk/CTK.git +~/work$ mkdir CTK-Superbuild +~/work/CTK-Superbuild$ cd CTK-Superbuild +~/work/CTK-Superbuild$ ccmake ../CTK +~/work/CTK-Superbuild$ make +``` + +* Then download and build Examples +``` +~/work$ git clone git://github.com/commontk/Examples.git +~/work$ mkdir Examples-build +~/work$ cd Examples-build +~/work/Examples-build$ ccmake ../Examples -DCTK_DIR:PATH=~/work/CTK-Superbuild/ +~/work/Examples-build$ make +``` + +* Run example1 +``` +~/work/Examples-build$ ./Example1/example1 +``` + +Help +---- + +More information on the CommonToolkit webpage: +* http://www.commontk.org + +Ask your questions on the CTK developer mailing list: +* http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers \ No newline at end of file