[Insight-users] easy way to get a file name extension

Luis Ibanez luis.ibanez at kitware.com
Mon Oct 12 18:43:31 EDT 2009


Hi Darren,

Yes, you will find all these basic methods
as part of the kwsys library.

In particular you should look at the class:

Insight/Utilities/kwsys/
SystemTools.cxx
SystemTools.hxx.in

> grep Filename *.hxx*

SystemTools.hxx.in:   *               Filename Manipulation Routines
SystemTools.hxx.in:  static kwsys_stl::string GetFilenamePath(const
kwsys_stl::string&);
SystemTools.hxx.in:  static kwsys_stl::string GetFilenameName(const
kwsys_stl::string&);
SystemTools.hxx.in:  static kwsys_stl::string
GetFilenameExtension(const kwsys_stl::string&);
SystemTools.hxx.in:  static kwsys_stl::string GetFilenameLastExtension(
SystemTools.hxx.in:  static kwsys_stl::string GetFilenameWithoutExtension(
SystemTools.hxx.in:  static kwsys_stl::string GetFilenameWithoutLastExtension(
SystemTools.hxx.in:   * If 'dir' is not a directory, GetFilenamePath()
is called on 'dir' to

See examples of their use in the Insight/Code/IO directory:

For example:

   #include <itksys/SystemTools.hxx>
   itksys::SystemTools::GetFilenameName(bestBaseline);


  Regards,


         Luis


-----------------------------------------------
On Mon, Oct 12, 2009 at 6:37 PM, Darren Weber
<darren.weber.lists at gmail.com> wrote:
>
> Are there any classes or methods for handling file names in ITK?
>
> Is it common to use Boost.Filesystem for handling files in an ITK project?
> http://www.boost.org/doc/libs/1_40_0/libs/filesystem/doc/index.htm
>
> The main problem before me is to extract and change a file extension, like
> substitute .tif to .xfm, and to output a spatial transform into the .xfm
> file with the same path and filename as the .tif file.  (The actual file
> extension may be any image file type, not specifically .tif).
>
> Thanks,
> Darren
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list