[Insight-users] using boost with ITK

Mark Roden mmroden at gmail.com
Wed Jan 13 11:42:04 EST 2010


Hi all,

I want to write some of my own programs using the cmake paradigm in
ITK.  I figure I should just do it rather than being a terrible whiner
(see my earlier posts about cmake....)

So far, I'm putting my programs into the Experimental directory, and
then everything seems to build fine, except for some file system calls
to scan a directory.  I want to combine some of the Insight Journal
articles into a specific pipeline that's run entirely within a C++
program, and that requires interacting with the filesystem (ie,
getting directory listings and the like).  It turns out, Windows has
two ways to do this, depending on whether or not the program was built
in a 64bit platform or a 32bit platform.

That's not going to fly, because I just want this stuff to work
without having to add a new #define for each operating system I come
across.  So, I want to add boost.filesystem to my little island of ITK
to properly interact with directories across platforms.  That library
has a 'path' object that just works, regardless of OS.

As a side note, I notice that several of the articles are using char*
for filenames, and that was my problem as well-- win7 64bit apparently
needs wchar_t, not char, so that code needs to be modified to work
properly.  Some of the IO classes (notably GDCMImageIO and
ImageFileWriter) depend on char* rather than wide chars, and I think
that a good step to complete compatibility would be to update that to
use the boost.filesystem.path.  While I realize that that will
probably be quite a bit of work, it would definitely stick within the
mission of being fully cross-platform, and as I understand it,
boost.filesystem will be part of the C++ standard in TR2.

So how about it?  How do I use boost.filesystem from a cmake-built itk
program placed in the Review directory?

Thanks,
Mark


More information about the Insight-users mailing list