Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rainygoblin committed Jan 8, 2014
0 parents commit fec6d22
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Build-VS/
26 changes: 26 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

41 changes: 41 additions & 0 deletions ImageViewer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
110 changes: 110 additions & 0 deletions ImageViewer/main.cpp
Original file line number Diff line number Diff line change
@@ -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 <QApplication>
#include <QFormLayout>
#include <QVBoxLayout>

#include <QApplication>
#include <QTreeView>
#include <QSettings>
#include <QDir>
#include <QResource>
// CTK includes
#include <ctkCheckablePushButton.h>
#include <ctkCollapsibleButton.h>
#include <ctkColorPickerButton.h>
#include <ctkRangeWidget.h>
#include <ctkDICOMAppWidget.h>
// ctkDICOMCore includes
#include "ctkDICOMDatabase.h"
#include "ctkDICOMModel.h"
// CTK Widgets
#include "ctkDICOMItemView.h"

// DCMTK includes
#include <dcmimage.h>
#include <QFileDialog>


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();
}
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fec6d22

Please sign in to comment.