Re: [mitk-users] QmitkRenderWindowWidget design flaw: Setting datastorage globally.

2020-06-30 Thread Carlo
Hello Amir,

As you have suggested, here is the PR: https://github.com/MITK/MITK/pull/248
.

I've made some changes in those files I sent you previously, also removed
some misleading comments I placed during the tests I did.

I created some minimal test applications, if you think this should be added
I'd appreciate guidance on how to add it to the project.

Cheers,

Carlo.


On Tue, Jun 30, 2020 at 5:39 AM Kalali, Amir 
wrote:

> Hello Carlo,
>
>
>
> Thank you for pointing that out. I took a look at it and I think you’re
> right, there seems to be a mixture of the individual rendering manager
> (which might or might not be the same for every render window widget) and
> the global, singleton rendering manager.
>
>
>
> The QmitkRenderWindowWidget was introduced while refactoring the rendering
> widgets to allow for a more flexible multi widget editor. Such a flexible
> multi widget editor should be able to display different image in parallel
> (with different geometry / view direction etc.) and thus it makes sense to
> also allow different data storages and rendering managers.
>
>
>
> I’m happy to see your changes contributed, just fork
> https://github.com/MITK/MITK and create a pull request. I looked at your
> changes and I would like to comment on it, which is easy having a PR.
>
>
>
> Best,
>
>
>
> Amir
>
>
>
> *From:* Carlo [mailto:cv.forn...@gmail.com]
> *Sent:* Thursday, 4 June, 2020 23:16
> *To:* mitk-users@lists.sourceforge.net
> *Subject:* [mitk-users] QmitkRenderWindowWidget design flaw: Setting
> datastorage globally.
>
>
>
> Hello,
>
> It's been a month since I started to develop an application using MITK as
> a toolkit. I need to render two independent 3D windows, to achieve this I
> choose the QmitkRenderWindowWidget, but inside QmitkRenderWindowWidget.cpp
> we have the method:
>
> (1) void QmitkRenderWindowWidget::InitializeGUI();
>
>
>
> This is a private method called by the constructor and inside it we have
> this line of code:
>
>
>
> (2) mitk::RenderingManager::GetInstance()->SetDataStorage(m_DataStorage);
>
>
>
> This code sets m_DataStorage's content globally, and at the moment we declare 
> QmitkRenderWindowWidget, all other rendering windows are modified.
>
>
>
> The behavior seems to be a design flaw, because QmitkRenderWindowWidget has a 
> method:
>
>
>
> (3) void QmitkRenderWindowWidget::SetDataStorage(mitk::DataStorage* 
> dataStorage);
>
>
>
> I can't tell for sure, but this method seems to set the datastorage only for 
> the current QmitkRenderWindowWidget. So there is no need for (2).
>
>
>
> Here is the next thing that took my attention:
>
>
>
> QmitkStdMultiWidget inherits QmitkAbstractMultiWidget, the last one has a 
> method:
>
>
>
> (4) void QmitkStdMultiWidget::SetDataStorage(mitk::DataStorage* dataStorage);
>
>
>
> QmitkStdMultiWidget has four rendering widgets, when calling method (4), 
> there are four callings for method (3), one for each rendering widget,
>
> but their constructors had already called four times the method (2), and this 
> last method has messed up every other rendering window in the current 
> application.
>
>
>
> For these reasons, I believe method (2) should be removed as it is there 
> probably by mistake. Also, the algorithms for widgets initialization doesn't
>
> appear to consider method (2) existence.
>
>
>
> I'd welcome any thoughts on this.
>
>
___
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users


Re: [mitk-users] Inheriting from Qmitk Widgets / widget promotion

2020-06-28 Thread Carlo
Hello Ivaylo,

I am using the MITK as a library, but I had a similar issue. I think the
problem is the IDE trying to find the files in the folder containing the
top-level CMakeLists.txt, then every library has to be relative to the
top-level directory. There are two ways to avoid this, use
include_directories() or target_include_directories() in your top-level
CMakeLists.txt. I recommend the second option.

I'm assuming you understand what the two commands above, if it's not the
case you can see my answer on how use MITK as a library, for examples:

https://stackoverflow.com/questions/58161124/how-to-use-mitk-as-a-library/62501246#62501246

On Sat, Jun 27, 2020 at 9:49 AM Ivaylo Angelov 
wrote:

> Dear all,
>
> I would highly appreciate some advice regarding the following issue:
>
> I have a plugin with a view in which I use the
> QmitkTransferFunctionGeneratorWidget (though the question is more general,
> could be any Qmitk widget).
> Now I would like to extend widget, therefore I created a custom one,
> inheriting from QmitkTransferFunctionGeneratorWidget within my plugin. (I
> am working with the Project template, by the way)
> The last thing I would like to do is to be able to promote a widget within
> my view to my custom widget and this is where I
> don't know how to continue.
> For Qmitk widgets it seems to just work by adding the header file name and
> the class name in the "Promoted widgets" tab
> of Qt Creator... given that I am inheriting from a Qmitk widget, is there
> a neat way to accomplish the same with my custom widget?
>
> I am aware that this has a lot to do with Qt but I am trying to understand
> how it is possible for the Qmitk widgets to be found by just typing in the
> name of the header file without the full path (I have added a screenshot to
> show what I mean) and I guess understanding that would help me accomplish
> what I am trying to do now.
>
> Thank you in advance and I look forward to hearing from you!
>
> Kind regards
> Ivaylo Angelov
> ___
> mitk-users mailing list
> mitk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
___
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users


[mitk-users] QmitkRenderWindowWidget design flaw: Setting datastorage globally.

2020-06-04 Thread Carlo
Hello,
It's been a month since I started to develop an application using MITK as a
toolkit. I need to render two independent 3D windows, to achieve this I
choose the QmitkRenderWindowWidget, but inside QmitkRenderWindowWidget.cpp
we have the method:

(1) void QmitkRenderWindowWidget::InitializeGUI();

This is a private method called by the constructor and inside it we have
this line of code:


(2) mitk::RenderingManager::GetInstance()->SetDataStorage(m_DataStorage);


This code sets m_DataStorage's content globally, and at the moment we
declare QmitkRenderWindowWidget, all other rendering windows are
modified.


The behavior seems to be a design flaw, because
QmitkRenderWindowWidget has a method:


(3) void QmitkRenderWindowWidget::SetDataStorage(mitk::DataStorage*
dataStorage);


I can't tell for sure, but this method seems to set the datastorage
only for the current QmitkRenderWindowWidget. So there is no need for
(2).


Here is the next thing that took my attention:


QmitkStdMultiWidget inherits QmitkAbstractMultiWidget, the last one
has a method:


(4) void QmitkStdMultiWidget::SetDataStorage(mitk::DataStorage* dataStorage);


QmitkStdMultiWidget has four rendering widgets, when calling method
(4), there are four callings for method (3), one for each rendering
widget,

but their constructors had already called four times the method (2),
and this last method has messed up every other rendering window in the
current application.


For these reasons, I believe method (2) should be removed as it is
there probably by mistake. Also, the algorithms for widgets
initialization doesn't

appear to consider method (2) existence.

I'd welcome any thoughts on this.
___
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users


Re: [mitk-users] Using MITK as a toolkit: CMake's find_package() can't find MITK

2020-04-30 Thread Carlo
Sorry,
My last email had some formatting issues, looking from gmail there was no
problem, but in the site the reading is unpleasant, its my first time
writing to a mail list. Below I copied the text, fixing the formatting:
--

Hi,

I found MITK 4 days ago. My goal is to use it as a toolkit to develop a Qt
UI.

I manage to successfully built from source, storing it at: ~/MITK-superbuild
*.*
Tested almost all examples sucessfully. MitkStep8 was the exception,
returns: segmentation fault. MitkWorkbench is also working fine*.*

Now I want to compile a simple HelloWorld example as described here [1].
But running CMake returns an error saying that MITK was not found.

Essentially my problem is the same as this unanswered stackoverflow
question: How to use MITK as a library [2]. Reading the comments the author
gave up and resorted to the template method.

I learned here [3] the difference between Module and Config mode for CMake.
If I understand correctly, the example is in Module mode. I tried some
custom changes to operate in Config mode without success*.*

My goal is to create many simple interfaces, but generating a template
project for each one doesn't seems the easiest way. Am I wrong? I just want
to find out which is the easiest way to use MITK as a toolkit, speeding up
my workflow, as I will be making a lot o projects from now on.

[1]
http://docs.mitk.org/2016.11/BuildInstructionsPage.html#BuildInstructions_As_Toolkit
[2]
https://stackoverflow.com/questions/58161124/how-to-use-mitk-as-a-library
[3]
https://stackoverflow.com/questions/20746936/what-use-is-find-package-if-you-need-to-specify-cmake-module-path-anyway/20857070#20857070

Appreciate your attention.
<https://stackoverflow.com/questions/58161124/how-to-use-mitk-as-a-library>
--

Additional info:
- Ubuntu 18.04
 - MITK 2018.4
 - CMake 3.17
 - Qt 5.12


On Thu, Apr 30, 2020 at 4:35 AM Carlo  wrote:

> Hi,
>
> I found MITK 4 days ago. My goal is to use it as a toolkit to develop a Qt
> UI.
>
> I manage to successfully built from source, storing it at:
> *~/MITK-superbuild.*
> Tested almost all examples sucessfully. *MitkStep8* was the exception,
> returns: segmentation fault. *MitkWorkbench is also working fine.*
>
> Now I want to compile a simple HelloWorld example as described here
> <http://docs.mitk.org/2016.11/BuildInstructionsPage.html#BuildInstructions_As_Toolkit>.
> But running CMake returns an error saying that MITK was not found.
>
> Essentially my problem is the same as this unanswered stackoverflow
> question: How to use MITK as a library
> <https://stackoverflow.com/questions/58161124/how-to-use-mitk-as-a-library>.
> Reading the comments the author gave up and resorted to the template
> method.
>
> I learned here <https://stackoverflow.com/a/20857070/5901259> the
> difference between *Module* and *Config *mode for CMake. If I understand
> correctly, the example is in *Module *mode. I tried some custom changes
> to operate in *Config *mode without success*.*
>
> My goal is to create many simple interfaces, but generating a template
> project for each one doesn't seems the easiest way. Am I wrong? I just want
> to find out which is the easiest way to use MITK as a toolkit, speeding up
> my workflow, as I will be making a lot o projects from now on.
>
> Appreciate your attention.
> <https://stackoverflow.com/questions/58161124/how-to-use-mitk-as-a-library>
>
___
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users


[mitk-users] Using MITK as a toolkit: CMake's find_package() can't find MITK

2020-04-30 Thread Carlo
Hi,

I found MITK 4 days ago. My goal is to use it as a toolkit to develop a Qt
UI.

I manage to successfully built from source, storing it at:
*~/MITK-superbuild.*
Tested almost all examples sucessfully. *MitkStep8* was the exception,
returns: segmentation fault. *MitkWorkbench is also working fine.*

Now I want to compile a simple HelloWorld example as described here
.
But running CMake returns an error saying that MITK was not found.

Essentially my problem is the same as this unanswered stackoverflow
question: How to use MITK as a library
.
Reading the comments the author gave up and resorted to the template
method.

I learned here  the
difference between *Module* and *Config *mode for CMake. If I understand
correctly, the example is in *Module *mode. I tried some custom changes to
operate in *Config *mode without success*.*

My goal is to create many simple interfaces, but generating a template
project for each one doesn't seems the easiest way. Am I wrong? I just want
to find out which is the easiest way to use MITK as a toolkit, speeding up
my workflow, as I will be making a lot o projects from now on.

Appreciate your attention.

___
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users