<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Michael,<br>
<br>
Welcome to the CTK mailing list.<br>
<br>
DICOM Application Hosting support in CTK is still work in progress,
so please be aware that not everything will work yet. Especially the
data exchange interface needs more work. Nevertheless, I hope my
comments below will get you started to experiment with your own Qt
based DICOM App. Comments, bug reports, patches etc. are also always
welcome!<br>
<br>
Best,<br>
Sascha<br>
<br>
On 05/13/2011 03:56 AM, Caylus, Michael (SCR US) wrote:
<blockquote
cite="mid:63D07F9AA364DB4C901F02EF93465C8D77E38B0FF8@USMLVA0E934MSX.ww017.siemens.net"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
<font face="Calibri, sans-serif" size="2">
<div>Hello,</div>
<div> </div>
<div>I am new to the CTK SDK and would like to wrap my Qt
application into an hosted app. I have seen such an example by
turning on in the CMake configuration: ctkExampleHost and
ctkExampleHosted App. I came up with the following questions
after playing with
it:</div>
<div> </div>
<ol style="margin-top: 0pt; margin-bottom: 0pt; margin-left:
36pt;">
<li>In order to make this wrap-up for my app; I was
considering to edit the org_commontk_dah_exampleapp plug-in
which relies on the org_commontk_dah_app and
org_commontk_dah_core plug-in and keep the
ctkExampleHostedApp. Is this approach the right way to
proceed?
This implies splitting my app into the hostedApp and a CTK
plugin; with most of the work to be done on the plug-in
level I guess. I have seen some doc explaining how to embed
the CTK plugin framework in my app too. Can I achieve the
same result with this approach
and how? </li>
</ol>
</font></blockquote>
As you have already seen, it is possible to use the plugin framework
from inside your own application and this is also the preferred way
(instead of modifying the existing CTK plug-ins directly). In the
case of a DICOM App, I can think of two different approaches,
depending on your requirements:<br>
<br>
1.) Your app is a "pure" DICOM App, i.e. you do not need run it
outside the context of a "Hosting Application"<br>
<br>
This is the easier approach. You would create your own plug-in,
equivalent to org.commontk.dah.exampleapp, which contains all your
app code (logic, widgets, etc.). Additionally, you create your own
ctkExampleHostedApp executable, which is essentially the same code
as in the CTK repository (just adapt paths and plug-in names).<br>
<br>
The
<a class="moz-txt-link-freetext" href="http://www.commontk.org/index.php/Documentation/CTK_Plugin_Framework:_Setting_up_a_project?action=purge">http://www.commontk.org/index.php/Documentation/CTK_Plugin_Framework:_Setting_up_a_project?action=purge</a>
tutorial explains how to create a CTK-based project.<br>
<br>
2.) You want to use your app both "stand-alone" and as a "hosted
app"<br>
<br>
This involves a little bit more knowledge about the plugin
framework, but should also be easy to achieve. What the
org.commontk.dah.exampleapp plug-in actually does, is to register a
class containing the DICOM "application logic" as a service within
the plugin-framework. You could either create this class (similar as
the ctkExampleDicomAppLocig class) inside your current project (not
in a separate plug-in) and register an instance by using the plugin
framework context, or create a small plug-in containing this class
and taking care of the registration itself. Then start the plugin
framework from inside your executable, if you recognize the host and
app url command line parameters (otherwise, create a QMainWindow
yourself).<br>
<br>
Depending on how fancy you would like to get concerning the
minimization of dependencies of your app in stand-alone mode to the
CTK libraries, you could think of a more complex set-up containing
two small wrapper executables, one for "app mode" starting the CTK
plugin framework and one for "stand-alone mode", both linked to a
library containing your application gui and logic...<br>
<br>
<blockquote
cite="mid:63D07F9AA364DB4C901F02EF93465C8D77E38B0FF8@USMLVA0E934MSX.ww017.siemens.net"
type="cite"><font face="Calibri, sans-serif" size="2">
<ol style="margin-top: 0pt; margin-bottom: 0pt; margin-left:
36pt;">
<li> I couldn’t find to which QMainWindow is the button
attached to in the <font size="3">ctkExampleDicomAppLogic::do_something()</font><font
size="3"> function</font><font size="3">.</font><font
size="3"> </font><font size="3"> It doesn</font><font
size="3">’</font><font size="3">t
look like the</font><font size="3">
ctkExampleDicomAppLogic is heritating from a widget</font><font
size="3"> also</font><font size="3">. Which object is
responsible of the creation of the mainwindow?</font></li>
</ol>
</font></blockquote>
<br>
The org.commontk.dah.exampleapp plugin does not create a
QMainWindow. It just create a button an shows it (moved and resized
to respect the prescribed screen area from the host). In Qt, widgets
become top-level windows if they don't have a parent widget and are
"shown".<br>
<br>
<blockquote
cite="mid:63D07F9AA364DB4C901F02EF93465C8D77E38B0FF8@USMLVA0E934MSX.ww017.siemens.net"
type="cite"><font face="Calibri, sans-serif" size="2">
<ol style="margin-top: 0pt; margin-bottom: 0pt; margin-left:
36pt;">
<li>Is there any doc that explains how to create a CTK plug-in
and App from scratch. It would be probably better in my case
to create a new plugin instead of editing an existing one.</li>
</ol>
</font></blockquote>
<br>
There is no doc about creating a plug-in yet, but you can easily
create one by using the ctkPluginGenerator executable (you may have
to enable it in CMake). It might have some rough edges though...<br>
<br>
A CTK "app" is actually nothing special. Any executable can do,
which links to the CTK libraries. The tutorial linked above explains
how to use the plugin framework in an arbitrary executable.<br>
<br>
<br>
<blockquote
cite="mid:63D07F9AA364DB4C901F02EF93465C8D77E38B0FF8@USMLVA0E934MSX.ww017.siemens.net"
type="cite"><font face="Calibri, sans-serif" size="2">
<ol style="margin-top: 0pt; margin-bottom: 0pt; margin-left:
36pt;">
<li>How can I add additional includes directories through a
CMakeLists in the CTK framework. I couldn’t find a way to
define additional directories in the CMakeList of a plug-in
(no include_directories). Is that define somewhere else?</li>
</ol>
</font></blockquote>
<br>
Inside CTK itself, include directories are set-up auto-magically
through our custom CMake dependency system. If you need to use
external libraries in your own CTK plug-in (contained in your own
project), just use standard CMake INCLUDE_DIRECTORIES (before
calling the ctkMacroBuildPlugin macro) and
LINK_LIBRARIES(${PROJECT_NAME} ...) (after the ctkMacroBuildPlugin
call) commands.<br>
<br>
Happy coding,<br>
<br>
Sascha<br>
</body>
</html>