[ITK] [ITK-users] Fail to execute TransformReadWrite example

Wagner Sales wsales at gmail.com
Fri Jul 4 18:43:28 EDT 2014


Hi,
I've found the problem. The class HDF5TransformIOTemplate makes an
extension check. After change the transform output file to Transforms.hdf,
works fine.
I think this needs to be changed on Example and on book, since explicity
talks:

  // Then we set the filename using the SetFileName() function. The file's
extension
  // does not matter for the transform reader/writer. Then we call the
Update()
  // function to write the transform(s) onto the disk.

The changed code are above:

template< typename TInternalComputationValueType >

bool

HDF5TransformIOTemplate< TInternalComputationValueType >

::CanWriteFile(const char *fileName)

{

  //

  // all extensions mentioned in wikipedia + 'hd5'

  // actually HDF doesn't care about extensions at

  // all and this is just by convention.

  const char *extensions[] =

  {

    ".hdf",".h4",".hdf4",".h5",".hdf5",".he4",".he5",".hd5",0,

  };

  std::string ext

    (itksys::SystemTools::GetFilenameLastExtension(fileName));

  for(unsigned i = 0; extensions[i] != 0; i++)

    {

    if(ext == extensions[i])

      {

      return true;

      }

    }

  return false;

}

Regards,

Wagner Sales


2014-07-04 18:41 GMT-03:00 Wagner Sales <wsales at gmail.com>:

> Hi all,
>
> I'm trying to save transforms and catching an strange error. I tried to
> execute the simple example on IO directory to validate this, and:
>
> --> checking permission
> wsales at wsales-desktop:/tmp/trf$ touch ihavepermission
> wsales at wsales-desktop:/tmp/trf$ ls -la
> total 28464
> drwxrwxr-x  2 wsales wsales     4096 Jul  4 17:52 .
> drwxrwxrwt 31 root   root      12288 Jul  4 17:52 ..
> -rw-rw-r--  1 wsales wsales        0 Jul  4 17:52 ihavepermission
> -rwxrwxr-x  1 wsales wsales 29128152 Jul  4 17:52 TransformReadWrite
>
> wsales at wsales-desktop:/tmp/trf$ ./TransformReadWrite test
> Error while saving the transforms
>
> itk::ExceptionObject (0x2af4c30)
> Location: "void itk::TransformFileWriterTemplate<ScalarType>::Update()
> [with ScalarType = double]"
> File:
> /home/wsales/Sources/InsightToolkit-4.5.2/Modules/IO/TransformBase/include/itkTransformFileWriter.hxx
> Line: 200
> Description: itk::ERROR: TransformFileWriterTemplate(0x2ae6300): Can't
> Create IO object for file Transforms.meta
>
> Since I can create the file, problem with permissions is not the issue.
> About my system ( latest Ubuntu, 'll update today ):
> uname  -a
> Linux wsales-desktop 3.13.0-27-generic #50-Ubuntu SMP Thu May 15 18:06:16
> UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
>
> Compiler:
> clang --version
> Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM
> 3.4)
> Target: x86_64-pc-linux-gnu
> Thread model: posix
>
> Some idea about this?
> This example was worked fine to me on ITK 3.20, before my version upgrade.
>
> Regards,
>
> Wagner Sales
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140704/24b4c0f8/attachment-0002.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

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://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list