Skip to content

Commit

Permalink
ENH: Add Visual Dicom Browser
Browse files Browse the repository at this point in the history
  • Loading branch information
Punzo committed Oct 5, 2023
1 parent 5657c58 commit 005ab16
Show file tree
Hide file tree
Showing 89 changed files with 15,571 additions and 956 deletions.
6 changes: 6 additions & 0 deletions CMake/ctkMacroSetupQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ macro(ctkMacroSetupQt)

# See https://github.com/commontk/CTK/wiki/Maintenance#updates-of-required-qt-components

if(CTK_LIB_Widgets
OR CTK_LIB_DICOM/Widgets
)
list(APPEND CTK_QT5_COMPONENTS Svg)
endif()

if(CTK_LIB_Widgets
OR CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTXML
)
Expand Down
6 changes: 6 additions & 0 deletions Libs/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ set(KIT_SRCS
ctkAbstractQObjectFactory.tpp
ctkAbstractLibraryFactory.h
ctkAbstractLibraryFactory.tpp
ctkAbstractTaskPool.cpp
ctkAbstractTaskPool.h
ctkAbstractTask.cpp
ctkAbstractTask.h
ctkBackTrace.cpp
ctkBooleanMapper.cpp
ctkBooleanMapper.h
Expand Down Expand Up @@ -100,6 +104,8 @@ endif()

# Headers that should run through moc
set(KIT_MOC_SRCS
ctkAbstractTask.h
ctkAbstractTaskPool.h
ctkBooleanMapper.h
ctkCallback.h
ctkCommandLineParser.h
Expand Down
35 changes: 35 additions & 0 deletions Libs/Core/ctkAbstractPoolManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*=========================================================================
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.
This file was originally developed by Davide Punzo, [email protected],
and development was supported by the Center for Intelligent Image-guided Interventions (CI3).
=========================================================================*/

#include "ctkAbstractTaskPool.h"

// --------------------------------------------------------------------------
ctkAbstractTaskPool::ctkAbstractTaskPool(QObject* parent)
: QObject(parent)
{
}

// --------------------------------------------------------------------------
ctkAbstractTaskPool::~ctkAbstractTaskPool()
{
}
52 changes: 52 additions & 0 deletions Libs/Core/ctkAbstractPoolManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*=========================================================================
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.
This file was originally developed by Davide Punzo, [email protected],
and development was supported by the Center for Intelligent Image-guided Interventions (CI3).
=========================================================================*/

#ifndef __ctkAbstractTaskPool_h
#define __ctkAbstractTaskPool_h

// Qt includes
#include <QObject>

// CTK includes
#include "ctkCoreExport.h"

//------------------------------------------------------------------------------
/// \ingroup Core
class CTK_CORE_EXPORT ctkAbstractTaskPool : public QObject
{
Q_OBJECT
public:
explicit ctkAbstractTaskPool(QObject* parent = 0);
virtual ~ctkAbstractTaskPool();

public Q_SLOTS:
virtual void taskStarted() = 0;
virtual void taskFinished() = 0;
virtual void taskCanceled() = 0;

private:
Q_DISABLE_COPY(ctkAbstractTaskPool)
};


#endif // ctkAbstractTaskPool_h
105 changes: 105 additions & 0 deletions Libs/Core/ctkAbstractTask.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*=========================================================================
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.
This file was originally developed by Davide Punzo, [email protected],
and development was supported by the Center for Intelligent Image-guided Interventions (CI3).
=========================================================================*/

#include "ctkAbstractTask.h"

// --------------------------------------------------------------------------
ctkAbstractTask::ctkAbstractTask()
{
this->Stop = false;
this->Running = false;
this->Finished = false;
this->TaskUID = "";
this->NumberOfRetry = 0;
}

//----------------------------------------------------------------------------
ctkAbstractTask::~ctkAbstractTask()
{
}

//----------------------------------------------------------------------------
void ctkAbstractTask::setTaskUID(const QString &taskUID)
{
this->TaskUID = taskUID;
}

//----------------------------------------------------------------------------
QString ctkAbstractTask::taskUID() const
{
return this->TaskUID;
}

//----------------------------------------------------------------------------
bool ctkAbstractTask::isStopped() const
{
return this->Stop;
}

//----------------------------------------------------------------------------
void ctkAbstractTask::setStop(const bool& stop)
{
this->Stop = stop;
}

//----------------------------------------------------------------------------
bool ctkAbstractTask::isFinished() const
{
return this->Finished;
}

//----------------------------------------------------------------------------
void ctkAbstractTask::setIsFinished(const bool& finished)
{
if (finished && this->Running)
{
this->Running = false;
}

this->Finished = finished;
}

//----------------------------------------------------------------------------
bool ctkAbstractTask::isRunning() const
{
return this->Running;
}

//----------------------------------------------------------------------------
void ctkAbstractTask::setIsRunning(const bool& running)
{
this->Running = running;
}

//----------------------------------------------------------------------------
int ctkAbstractTask::numberOfRetry() const
{
return this->NumberOfRetry;
}

//----------------------------------------------------------------------------
void ctkAbstractTask::setNumberOfRetry(const int& numberOfRetry)
{
this->NumberOfRetry = numberOfRetry;
}

89 changes: 89 additions & 0 deletions Libs/Core/ctkAbstractTask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*=========================================================================
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.
This file was originally developed by Davide Punzo, [email protected],
and development was supported by the Center for Intelligent Image-guided Interventions (CI3).
=========================================================================*/

#ifndef __ctkAbstractTask_h
#define __ctkAbstractTask_h

// Qt includes
#include <QObject>
#include <QRunnable>

// CTK includes
#include "ctkCoreExport.h"

//------------------------------------------------------------------------------
/// \ingroup Core
class CTK_CORE_EXPORT ctkAbstractTask : public QObject, public QRunnable
{
Q_OBJECT
Q_PROPERTY(QString taskUID READ taskUID WRITE setTaskUID);
Q_PROPERTY(bool stop READ isStopped WRITE setStop);
Q_PROPERTY(bool running READ isRunning WRITE setIsRunning);
Q_PROPERTY(bool finished READ isFinished WRITE setIsFinished);
Q_PROPERTY(bool numberOfRetry READ numberOfRetry WRITE setNumberOfRetry);

public:
explicit ctkAbstractTask();
virtual ~ctkAbstractTask();

/// Execute task
virtual void run() = 0;

/// Task UID
QString taskUID() const;
virtual void setTaskUID(const QString& taskUID);

/// Stop task
bool isStopped() const;
virtual void setStop(const bool& stop);

/// Finished
bool isFinished() const;
void setIsFinished(const bool& finished);

/// Running
bool isRunning() const;
void setIsRunning(const bool& running);

/// Number of retries: current counter of how many times
/// the task has been relunched on fails
int numberOfRetry() const;
void setNumberOfRetry(const int& numberOfRetry);

Q_SIGNALS:
void started();
void finished();
void canceled();

private:
Q_DISABLE_COPY(ctkAbstractTask)

QString TaskUID;
bool Stop;
bool Running;
bool Finished;
int NumberOfRetry;
};


#endif // ctkAbstractTask_h
35 changes: 35 additions & 0 deletions Libs/Core/ctkAbstractTaskPool.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*=========================================================================
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.
This file was originally developed by Davide Punzo, [email protected],
and development was supported by the Center for Intelligent Image-guided Interventions (CI3).
=========================================================================*/

#include "ctkAbstractTaskPool.h"

// --------------------------------------------------------------------------
ctkAbstractTaskPool::ctkAbstractTaskPool(QObject* parent)
: QObject(parent)
{
}

// --------------------------------------------------------------------------
ctkAbstractTaskPool::~ctkAbstractTaskPool()
{
}
Loading

0 comments on commit 005ab16

Please sign in to comment.