[Insight-users] Re: ITK and C++ Builder (Segmentation and GUI), how glue it together?

Gabriel Camporredondo Díaz gabrielc at ece.ubc.ca
Wed May 4 00:50:47 EDT 2005


Hi, Emiliano
Thanks for your clear explanation regarding itk libraries in BCB. I 
followed your lines including "Add to project..." and 
"Directories/Conditionals" and it works. ITK libraries are recognized 
and all the clases used by the header file implementation *.h are added 
to the project. ... then (pls keep going, interesting part is coming)... 
everything was going great until a compilation of a read/write image 
example that generates the following problem  when the /reader->Update( 
)/ line is excecuted. I know it is something about the pipeline. In 
fact, the same problem is encountered creating the file and running it 
from the console (out of BCB but using its compiler)?? Any idea??

If you and/or other BCB+ITK tester are currently running BCB projects 
with itk, would you mind to share a HelloWord project or more helpfull a 
"Image read and write" project?? I will really appreciate. Thanks Emiliano.



Emiliano Beronich wrote:

> Hi Gabriel,
>
> For adding libraries to the project drag to the project manager window 
> (or click on the entry "Project" | "Add to Project..." and select) the 
> ITK library files you need. If you don't know which files you need, 
> just add all the lib files on the bin directory of your itk 
> compilation. At worst, this can produce a little overhead on the 
> filesize of your exe.
>
> For including the header files, you need to indicate the path to the 
> header files you refer in the project. In order to do it, open the 
> entry "Project" |"Options" | "Directories/Conditionals" tab and add 
> the path to the header files you refer to.
>
> Regards,
> Emiliano
>
>
> Gabriel Camporredondo Díaz wrote:
>
>> Hello Emiliano and Michal,
>>
>> Great hints from you, however my results weren't so successful since 
>> I guess I am some steps before of where you guys are. Could you 
>> please check the following steps and suggest me what is missing and 
>> how to go on,
>>
>> 1. Download and Compile ITK libraries with cmake (setting 
>> CMAKE_BUILD_TYPE = MinSizeRel). I got the makefiles, yes!
>>
>> 2. Then run make.exe to finally generate ITK libraries 
>> (itkcommon.lib, itkIO.lib and son on with itk*.lib). Done!
>>
>> um, ?? :o| …then what? Can ITK libraries be stored and linked as 
>> static libraries and then use their classes from my project units?? 
>> If so, where are my header files (itk*.h)?? how can I link my 
>> libraries .lib to my bcb project??
>>
>> I will really appreciate if could clarify this to me. Thanks for your 
>> kind help in advance.
>>
>>
>>
>> Emiliano Beronich wrote:
>>
>>> Hi Michael and Gabriel,
>>>
>>> We were able to run ITK on C++ Builder environment and build a whole 
>>> application. We use ITK for processing and VTK for image display.
>>>
>>> Here are the lessons we learned from our experience with ITK and 
>>> Builder 5.
>>>
>>> -In order to compile ITK with a Borland product, you should use 
>>> Builder 5 or the Borland free compiler. ITK doesn´t compile with 
>>> Builder 6. Maybe in the future someone can generate a compilable 
>>> version of ITK for Builder 6, I don´t know.
>>>
>>> -The way to avoid access violations is to delete all the ITK classes 
>>> before the destruction of the main form (setting 0 or NULL to the 
>>> SmartPointer in the close event of the main form, as in 
>>> http://public.kitware.com/pipermail/insight-users/2003-February/002572.html). 
>>> Not doing this results in an exception of access violation when 
>>> closing the application.
>>>
>>> -Enabling the compiler option "Use dynamic RTL" for building the 
>>> projects sometimes can generate errors on the release compilation. 
>>> It is solved disabling the option. Maybe this can be due to a bug on 
>>> the manage of templates on the DLL of STL library accompanying 
>>> Builder 5.
>>>
>>> -As Michal said, in order to compile ITK with Builder 5, you should 
>>> set CMAKE_BUILD_TYPE = MinSizeRel (if BUILD_SHARED_LIBS = Off). In a 
>>> project you have to set "include directories" and "link directories" 
>>> manually, because CMake doesn't generate C++ Builder projects. You 
>>> also have to add libraries manually to the project.
>>>
>>> -If you enable the BUILD_SHARED_LIBS option, ITK can be compiled for 
>>> debug, for release, etc. You should modify at hand the makefiles to 
>>> avoid using the RTL DLLs (Use dynamic RTL = off). Eliminate the 
>>> parameter "-tWR" from the makefile. Now we can debug the code inside 
>>> of the itkCommon.lib. The application must see on the path the file 
>>> itkCommon.dll and itkCommon.tds. Maybe the default behaviour of 
>>> CMAKE should be modified to incorporate this change.
>>>
>>> -It's recommended to install the patch for Builder 5. Some errors 
>>> were solved after the installation of the patch.
>>>
>>> -On the conditional defines (Directories/Conditionals tab) of the 
>>> project maybe you need to add the following words:
>>> STRICT
>>> NO_WIN32_LEAN_AND_MEAN
>>>
>>> The first is needed if you use vtk. The define STRICT avoid a 
>>> conflict with HWND when reading "vtkWin32OpenGLRenderWindow.h".
>>> The second if you use "shlobj.h" or "shellapi.h", but this has 
>>> nothing to do with itk.
>>>
>>> Regards,
>>> Emiliano Beronich
>>>
>>>
>>>
>>> sandarak at wp.pl wrote:
>>>
>>>> Hi Gabriel
>>>>
>>>> Yes. I was trying to get ITK and Builder to work together But with no
>>>> final success. It would compile and as far as I remember some simple
>>>> examples would work but others would generate Access Violation Error.
>>>> So I'm using FLTK to make GUI. Another good thing about using FLTK is
>>>> that are many examples of working applications which use it.
>>>>
>>>> - first important thing is that you have to use C++ Builder 5.x.
>>>> Builder 6 (as I've read in mialing list) can't compile templated code
>>>>
>>>> - Compiler which comes with C++ Builder 5 is ver 5.5.0 and it won't
>>>> compile ITK. You have to download the compiler from Borland site (it's
>>>> free) and overwrite files from binary directory of builder with the
>>>> ones from the compiler you downloaded (it's version 5.5.1).
>>>>
>>>> - If you want to build itk, you have to use MinSizeRel flag in cmake.
>>>> It's ( as I've read on mailng list) because of some restrictions of
>>>> borland linker to work with projects bigger than 32 MB (or some value
>>>> near 30MBs)
>>>>
>>>> - You have to set "include directories" and "link directories"
>>>> manually, because CMake doesn't generate C++ Builder projects.
>>>> You also have to add libraries manually to the project
>>>>
>>>> - You also have to change settings of compiler and linker in the
>>>> project file to resemble those which Cmake uses. (But Builder will
>>>> change them automatically after you open project, which is rather
>>>> disastrous and I don't know how to change this behaviour)
>>>>
>>>> What Can I say. Trying to get ITK work together with Builder is a 
>>>> waste
>>>> of time and energy in my opinion. And you probably wont get much help
>>>> from mailing list because ITK can be compiled using Borland 
>>>> Compiler but
>>>> not using C++ builder enviroment.
>>>>
>>>> If it's possible I suggest you migrate to MS Visual 6.0 and use it as
>>>> compiler and debug tool. Use FLTK to create GUI. And VTK to visualize.
>>>>
>>>>
>>>> Regards
>>>>
>>>> Michal
>>>>
>>>>
>>>>> Hi Michal Postrozny,
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Googling I found your posting regarding C++ Builder joing ITK 
>>>>> libraries.
>>>>> I was wondering if I got any valuable answer from Insight-List. If 
>>>>> so, I
>>>>> will really appreciate if you can share the hint.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Best Regards
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Gabriel
>>>>> UBC - ECE Department
>>>>> Vancouver, B.C. Canada
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Insight-users mailing list
>>>> Insight-users at itk.org
>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>>
>>
>>
>
>



More information about the Insight-users mailing list