[Insight-users] VTK->ITK problem
Luis Ibanez
luis.ibanez at kitware.com
Thu, 08 Apr 2004 15:46:56 -0400
Hi Walter,
Yeap, Debug/Release makes a huge difference in performance
given that ITK is using templated code and we rely on a
number of optimizations that only ocurr when compiling for
release.
For instructions on how to use CMake for configuring a
project that uses ITK, VTK and MFC you will find previous
postings on the list. Please use the Google search that
you will find at the top of the users-list page.
http://www.itk.org/mailman/listinfo/insight-users
It will led you to postings like the following:
http://www.itk.org/pipermail/insight-users/2003-March/002751.html
Regards,
Luis
----------------
I`ì°× wrote:
> Luis,
> You're great:)
> The problem is really the debug/release problem, it has been solved. Thank you!
>
> And as you mentioned the configuration using CMake is much more simple. But up to now I don't how to use CMake to config environment with all of the VTK+ITK+MFC. Can you give me some instruction or let me know where the instruction is.
>
> Best Regards:)
>
> Walter
>
>
>
> 在 2004-04-08 14:21:00 您写道:
>
>>Hi Tianbai,
>>
>>As you just pointed out, this is one of those
>>time-wasting issues that you could have avoided
>>by simply using CMake for configuring your project.
>>
>>CMake takes care enabling the right compiler flags
>>for projects that are using ITK.
>>
>>
>>---
>>
>>About the performance drop when you use MFC, the
>>typical suspects are:
>>
>>
>>1) you are probably building the MFC project for
>> Debug while the one without MFC was build for
>> release.
>>
>>or
>>
>>
>>2) You may have connected observers to the ITK
>> filters in order to update your MFC GUI and
>> some of the GUI refreshing activities are
>> taking more than what you expected.
>>
>>
>>Regards,
>>
>>
>>
>> Luis
>>
>>
>>
>>---------------
>>I`ì°× wrote:
>>
>>
>>>Hi,Luis:
>>> Thank you for your instruction, the problem has been solved. I finally find it out that it's because my project setting problem, a parameter which should be /GR is set as /GX, I don't know the difference but when i change it, the problem is just solved. Maybe it's because i config the enviorment manually, not using CMake, so a lot of abnormal problem occur.
>>> But now I have a strange phenomenon, when i using the pure C++ to do the segment process using fastmarching algorithm, it only cost 9 seconds, but the same process in MFC will cost nearly 35 seconds. I'm surely the data source and all the parameters are the same,and also I have try the levelset algorithm, but the result is the same, costing much longer time. So I'm puzzled by this, and don't know how to improve it. Can you help me? Thanks a lot:)
>>>
>>> Walter
>>>
>>>在 2004-04-07 14:47:00 您写道:
>>>
>>>
>>>>Hi Tianbai,
>>>>
>>>>Both ITK and VTK are independent of the GUIs,
>>>>so there is nothing special that you should
>>>>do under MFC.
>>>>
>>>>One possibility for error is that you may be
>>>>attempting to use the output of an ITK or VTK
>>>>filter before it has been updated ( invoked
>>>>the Update() method). The output of filters
>>>>are not valid until update is called. If for
>>>>example you are trying to visualize an image
>>>>taken from a filter that has not been updated,
>>>>it is certain that you will run into trouble.
>>>>
>>>>
>>>>It will help if you post the error message that
>>>>you get when you run the pipeline under MFC...
>>>>
>>>>
>>>>Regards,
>>>>
>>>>
>>>> Luis
>>>>
>>>>
>>>>--------------
>>>>I`ì°× wrote:
>>>>
>>>>
>>>>
>>>>>Hi,Luis
>>>>>
>>>>> Thanks for reply, the problem has been solved, but another problem bothers me a lot. It's still about the vtk->itk->vtk pipeline, it work quite well in pure C++, but in MFC enviorment, there's always the debug error as last time. And i know it must be something wrong with the vtkdata out of the vtkimporter, or there is no data output at all. But i can't figure out why the same code doesn't turn out the same. Is there anything specical in the MFC environment?
>>>>> I simplify the as below:
>>>>>
>>>>> vtkImageExport* vtkExporter = vtkImageExport::New();
>>>>> vtkExporter->SetInput(source->GetOutput());
>>>>>
>>>>> typedef itk::VTKImageImport<ImageType> ImageImportType;
>>>>> ImageImportType::Pointer imageImporter = ImageImportType::New();
>>>>> ConnectPipelines(vtkExporter, imageImporter)
>>>>>
>>>>> typedef itk::VTKImageExport<ImageType> ImageExportType;
>>>>> ImageExportType::Pointer itkExporter = ImageExportType::New();
>>>>> itkExporter->SetInput(imageImporter->GetOutput());
>>>>>
>>>>> vtkImageImport* vtkImporter = vtkImageImport::New();
>>>>> ConnectPipelines(itkExporter, vtkImporter);
>>>>>
>>>>> Thanks again:)
>>>>>
>>>>>在 2004-04-06 16:30:00 您写道:
>>>>>
>>>>>
>>>>>
>>>>>>Hi Tianbai,
>>>>>>
>>>>>>Please post the exact error message that
>>>>>>you get when you are running this code.
>>>>>>
>>>>>>
>>>>>>Thanks
>>>>>>
>>>>>>
>>>>>>Luis
>>>>>>
>>>>>>
>>>>>>------------------
>>>>>>Tianbai wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>HI,
>>>>>>> i have a problem when convert vtk to itk. i use the
>>>>>>>\InsightApplications-1.6.0\Auxiliary\vtk directory 's
>>>>>>>itkVTKImageToImageFilter, but everytime when update there is a debug
>>>>>>>error, i can't figure out the problem,did i miss something?
>>>>>>> Can you help me? thanks a lot
>>>>>>> WALTER
>>>>>>>
>>>>>>>/////////////////////////////////////////////////////////////////////////
>>>>>>>const unsigned int Dimension = 3;
>>>>>>>typedef float PixelType;
>>>>>>>typedef itk::Image< PixelType, Dimension > ImageType;
>>>>>>>
>>>>>>>
>>>>>>>typedef itk::VTKImageToImageFilter<ImageType> vtk2itkType;
>>>>>>>vtk2itkType::Pointer vtk2itk = vtk2itkType::New();
>>>>>>>
>>>>>>>vtk2itk->SetInput(v16->GetOutput());//using vtkvolume16reader data
>>>>>>>
>>>>>>>vtk2itk->Update();
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>> 致
>>>>>礼!
>>>>>
>>>>> 天白
>>>>> tianbai at sjtu.edu.cn
>>>>>
>>>>>
>>>
>>>
>>> 致
>>>礼!
>>>
>>> 天白
>>> tianbai at sjtu.edu.cn
>>>
>>>
>
>
> 致
> 礼!
>
> 天白
> tianbai at sjtu.edu.cn
>
>