[vtk-developers] SetInput fails?

Berk Geveci berk.geveci at kitware.com
Tue Jun 1 11:11:34 EDT 2010


You might have to add a debug line that calls vtkExecutive::PRODUCER()
if the debugger does not allow you to call arbitrary functions.

On Tue, Jun 1, 2010 at 9:07 AM, Tim Peeters <thjmpeeters at gmail.com> wrote:
> I don't see it in SetInputConnection.
>
> BTW, I am using VTK 5.4.2. Did anything change here for 4.6?
>
> On Mon, May 31, 2010 at 16:40, Berk Geveci <berk.geveci at kitware.com> wrote:
>> Hrmpf.
>>
>> Does vtkExecutive::PRODUCER() return the same value inside
>> SetInputConnection() and GetInputConnection()?
>>
>> -berk
>>
>> On Mon, May 31, 2010 at 10:12 AM, Tim Peeters <thjmpeeters at gmail.com> wrote:
>>> They are the same.
>>>
>>> On Mon, May 31, 2010 at 16:06, Berk Geveci <berk.geveci at kitware.com> wrote:
>>>> Can you compare the value of the input information in
>>>> GetInputConnection (the info variable) with this:
>>>>
>>>> dti->GetProducerPort()->GetProducer()->GetExecutive()->GetOutputInformation(0)
>>>>
>>>> -berk
>>>>
>>>>
>>>> On Mon, May 31, 2010 at 9:54 AM, Tim Peeters <thjmpeeters at gmail.com> wrote:
>>>>> I execute filter->GetExecutive() before setting input, after setting
>>>>> input, and after getting input. The address is always the same so the
>>>>> executive of the filter does not change.
>>>>>
>>>>> Tim.
>>>>>
>>>>>
>>>>> On Mon, May 31, 2010 at 15:44, Berk Geveci <berk.geveci at kitware.com> wrote:
>>>>>>> As I said, I do not fully understand what happens with the executives.
>>>>>>> Does each filter have exactly one executive, and this executive should
>>>>>>> not change? And the executive contains links to the input and output
>>>>>>> ports of the filter?
>>>>>>
>>>>>> Once the executive is set, it should not change. If it does, the input
>>>>>> connections and the output would be wiped. Yes, the executive contains
>>>>>> the input connections and the output information.
>>>>>>
>>>>>> Can you check if the executive changes?
>>>>>>
>>>>>> -berk
>>>>>>
>>>>>>
>>>>>> On Mon, May 31, 2010 at 6:04 AM, Tim Peeters <thjmpeeters at gmail.com> wrote:
>>>>>>> Yes, I debugged vtkAlgorithm::SetInputConnection(..) in MSVC 2008 Express.
>>>>>>>
>>>>>>> I do not fully understand what happens with the executives etc, but
>>>>>>> everything seems to go fine.
>>>>>>>
>>>>>>> All variables (producer, consumer, newInfo) get a value, and the
>>>>>>> function returns in the end after this->Modified() is called.
>>>>>>> producerPort and consumerPort are set to 0.
>>>>>>>
>>>>>>> After setting the input, I call vtkAlgorithm::GetInputConnection(0,0).
>>>>>>> Inside this function, the info object gets a value, but after the call
>>>>>>> of vtkExecutive::PRODUCER()->Get(info, producer, producerPort), the
>>>>>>> producer variable holds the value NULL.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> As I said, I do not fully understand what happens with the executives.
>>>>>>> Does each filter have exactly one executive, and this executive should
>>>>>>> not change? And the executive contains links to the input and output
>>>>>>> ports of the filter?
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Tim.
>>>>>>>
>>>>>>> On Sun, May 30, 2010 at 21:47, Berk Geveci <berk.geveci at kitware.com> wrote:
>>>>>>>> Can you step through void vtkAlgorithm::SetInputConnection(int port,
>>>>>>>> vtkAlgorithmOutput* input) in a debugger?
>>>>>>>>
>>>>>>>> On Sun, May 30, 2010 at 1:57 PM, Tim Peeters <thjmpeeters at gmail.com> wrote:
>>>>>>>>> filter->GetInputConnection(0, 0) also returns NULL.
>>>>>>>>>
>>>>>>>>> Even after calling filter->SetInputConnection(0,
>>>>>>>>> dti->GetProducerPort()); it returns NULL. SetInput and
>>>>>>>>> SetInputConnection functions seem to have the same effect. After
>>>>>>>>> calling one of these, filter->GetTotalNumberOfInputConnections() and
>>>>>>>>> filter->GetNumberOfInputConnections(0) both return 1, but GetInput()
>>>>>>>>> and GetInputConnection() both return NULL.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Each of the plug-ins is loaded from its own DLL. I had problems with
>>>>>>>>> this before when I defined a singleton (static global) Core object
>>>>>>>>> because on Mac and Windows (MSVC), each of the libraries had their own
>>>>>>>>> Core object, while on Linux (gcc) there was one Core object for all
>>>>>>>>> DLL's. I fixed that problem by passing the Core object to each of the
>>>>>>>>> plug-ins when they are loaded instead of making it global. This solved
>>>>>>>>> the problems there, but maybe this new problem is somehow related.
>>>>>>>>> Again on Linux everything works perfectly, but on Mac and Windows I
>>>>>>>>> have problems. I was checking VTK for possible use of global variables
>>>>>>>>> that do not work across multiple DLL's, but I couldn't find any. Also,
>>>>>>>>> I cannot find out where exactly in the GetInputConnection function it
>>>>>>>>> goes wrong.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Tim.
>>>>>>>>>
>>>>>>>>> On Sun, May 30, 2010 at 19:30, Berk Geveci <berk.geveci at kitware.com> wrote:
>>>>>>>>>> What does filter->GetInputConnection(0, 0) return?
>>>>>>>>>>
>>>>>>>>>> -berk
>>>>>>>>>>
>>>>>>>>>> On Sat, May 29, 2010 at 9:31 PM, Tim Peeters <thjmpeeters at gmail.com> wrote:
>>>>>>>>>>> Hi all,
>>>>>>>>>>>
>>>>>>>>>>> To make it a bit more clear, I wrote a test plug-in with the following function:
>>>>>>>>>>>
>>>>>>>>>>> void VTKPipelineTestPlugin::dataSetAdded(data::DataSet* ds)
>>>>>>>>>>> {
>>>>>>>>>>>        if (ds->getKind() != "DTI") return;
>>>>>>>>>>>
>>>>>>>>>>>        vtkImageData* dti = ds->getVtkImageData();
>>>>>>>>>>>        Q_ASSERT(dti);
>>>>>>>>>>>
>>>>>>>>>>>        QString basename = ds->getName();
>>>>>>>>>>>        qDebug()<<"Dataset"<<ds<<"with name"<<basename<<"and
>>>>>>>>>>> kind"<<ds->getKind()<<"seems usable.";
>>>>>>>>>>>
>>>>>>>>>>>        vtkSimpleImageFilterExample* filter = vtkSimpleImageFilterExample::New();
>>>>>>>>>>>        qDebug()<<"setting intput to"<<dti;
>>>>>>>>>>>        filter->SetInput(dti);
>>>>>>>>>>>        qDebug()<<"input is"<<filter->GetInput();
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> when I run the software, and this function is executed, the output is
>>>>>>>>>>> as follows:
>>>>>>>>>>>
>>>>>>>>>>> Dataset 0x101db9ed0 with name "1" and kind "DTI" seems usable.
>>>>>>>>>>> setting intput to 0x11aa5a8f0
>>>>>>>>>>> input is 0x0
>>>>>>>>>>>
>>>>>>>>>>> What can be wrong here? Where can I look to find out why Set or
>>>>>>>>>>> GetInput() fails?
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Tim.
>>>>>>>>>>>
>>>>>>>>>>> On Fri, May 28, 2010 at 20:53, Tim Peeters <thjmpeeters at gmail.com> wrote:
>>>>>>>>>>>> Dear developers,
>>>>>>>>>>>>
>>>>>>>>>>>> I am developing a VTK-based application that uses a plug-in system to
>>>>>>>>>>>> add functionality to the core system.
>>>>>>>>>>>> I am loading plug-ins (which are loaded as DLL's on Windows) using the
>>>>>>>>>>>> Qt plugin system.
>>>>>>>>>>>>
>>>>>>>>>>>> The following code, in one of the plugins, fails:
>>>>>>>>>>>>
>>>>>>>>>>>> vtkTensorToEigensystemFilter* eigen = vtkTensorToEigensystemFilter::New();
>>>>>>>>>>>> // dti is a valid vtkImageData object
>>>>>>>>>>>> eigen->SetInput(dti);
>>>>>>>>>>>> vtkImageData* eigenOut = eigen->GetOutput();
>>>>>>>>>>>> // eigenOut == NULL
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> vtkTensorToEigensystemFilter is a subclass of
>>>>>>>>>>>> vtkSimpleImageToImageFilter which basically only implements the
>>>>>>>>>>>> SimpleExecute() function and thus does not change the {Get,Set}Input()
>>>>>>>>>>>> function(s). Since eigenOut == NULL, I assume that SetInput or
>>>>>>>>>>>> GetOutput() fails, and I have been debugging but I get lost in the VTK
>>>>>>>>>>>> pipeline and I cannot trace back the error. In a different place I use
>>>>>>>>>>>> vtkExtractVOI in a similar way as vtkTensorToEigenSystemFilter, and I
>>>>>>>>>>>> get the same problem.
>>>>>>>>>>>>
>>>>>>>>>>>> dti is a vtkImageData that is constructed in a different plugin and is
>>>>>>>>>>>> the output of a reader. All the functions used to work in one "big"
>>>>>>>>>>>> application that did not use plugins, but now it fails in MSVC2008
>>>>>>>>>>>> express on Windows. I usually do my development on Linux (Ubuntu and
>>>>>>>>>>>> Slackware), and with GCC on Linux everything works fine. On Windows,
>>>>>>>>>>>> different parts of the pipeline are built in different dll's
>>>>>>>>>>>> (plugins), but the image data (dti) and its producer port seem to be
>>>>>>>>>>>> consistent in the plugin that creates the dti dataset and the plugin
>>>>>>>>>>>> that uses it.
>>>>>>>>>>>>
>>>>>>>>>>>> Does anyone have any clues how I can track where this problem comes from?
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks a lot!
>>>>>>>>>>>> Tim.
>>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> Powered by www.kitware.com
>>>>>>>>>>>
>>>>>>>>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>>>>>>>>
>>>>>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>>>>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>>
>>>
>>
>



More information about the vtk-developers mailing list