[prev in list] [next in list] [prev in thread] [next in thread]
List: insight-users
Subject: Re: [ITK-users] Fail to execute TransformReadWrite example
From: Wagner Sales <wsales () gmail ! com>
Date: 2014-07-04 22:43:28
Message-ID: CA+5pysiPrrTs+rDpnsmNGKiNtqJYSnMJ85MGyWhAOsBSZAQkTA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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@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@wsales-desktop:/tmp/trf$ touch ihavepermission
> wsales@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@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
>
>
>
>
[Attachment #5 (text/html)]
<div dir="ltr">Hi,<br>I've found the problem. The class HDF5TransformIOTemplate \
makes an extension check. After change the transform output file to Transforms.hdf, \
works fine.<br>I think this needs to be changed on Example and on book, since \
explicity talks: <br> <br> // Then we set the filename using the SetFileName() \
function. The file's extension<br> // does not matter for the transform \
reader/writer. Then we call the Update()<br> // function to write the transform(s) \
onto the disk.<br> <br>The changed code are above:<br><br>template< typename \
TInternalComputationValueType ><br><br>bool<br><br>HDF5TransformIOTemplate< \
TInternalComputationValueType ><br><br>::CanWriteFile(const char *fileName)<br> \
<br>{<br><br> //<br><br> // all extensions mentioned in wikipedia + \
'hd5'<br><br> // actually HDF doesn't care about extensions at<br><br> \
// all and this is just by convention.<br><br> const char *extensions[] =<br> <br> \
{<br><br> ".hdf",".h4",".hdf4",".h5",".hdf5",".he4",".he5",".hd5",0,<br><br> \
};<br><br> std::string ext<br><br> \
(itksys::SystemTools::GetFilenameLastExtension(fileName));<br> <br> for(unsigned i \
= 0; extensions[i] != 0; i++)<br><br> {<br><br> if(ext == \
extensions[i])<br><br> {<br><br> return true;<br><br> \
}<br><br> }<br><br> return false;<br><br>}<div><br><div>Regards,</div> \
<div><br></div><div>Wagner Sales</div></div></div><div \
class="gmail_extra"><br><br><div class="gmail_quote">2014-07-04 18:41 GMT-03:00 \
Wagner Sales <span dir="ltr"><<a href="mailto:wsales@gmail.com" \
target="_blank">wsales@gmail.com</a>></span>:<br> <blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div \
dir="ltr">Hi all,<div><br></div><div>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:</div> <div><br></div><div>--> checking permission</div>
<div><div>wsales@wsales-desktop:/tmp/trf$ touch \
ihavepermission<br></div><div>wsales@wsales-desktop:/tmp/trf$ ls -la</div><div>total \
28464</div><div>drwxrwxr-x 2 wsales wsales 4096 Jul 4 17:52 \
.</div><div>drwxrwxrwt 31 root root 12288 Jul 4 17:52 ..</div>
<div>-rw-rw-r-- 1 wsales wsales 0 Jul 4 17:52 \
ihavepermission</div><div>-rwxrwxr-x 1 wsales wsales 29128152 Jul 4 17:52 \
TransformReadWrite</div><div><br></div><div>wsales@wsales-desktop:/tmp/trf$ \
./TransformReadWrite test</div>
<div>Error while saving the transforms</div><div><br></div><div>itk::ExceptionObject \
(0x2af4c30)</div><div>Location: "void \
itk::TransformFileWriterTemplate<ScalarType>::Update() [with ScalarType = \
double]" </div>
<div>File: /home/wsales/Sources/InsightToolkit-4.5.2/Modules/IO/TransformBase/include/itkTransformFileWriter.hxx</div><div>Line: \
200</div><div>Description: itk::ERROR: TransformFileWriterTemplate(0x2ae6300): \
Can't Create IO object for file Transforms.meta</div>
</div><div><br></div><div>Since I can create the file, problem with permissions is \
not the issue.</div><div>About my system ( latest Ubuntu, 'll update today \
):</div><div><div>uname -a</div><div>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</div>
</div><div><br></div><div>Compiler:</div><div><div>clang --version</div><div>Ubuntu \
clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM \
3.4)</div><div>Target: x86_64-pc-linux-gnu</div><div>Thread model: posix</div>
</div><div><br></div><div>Some idea about this? </div><div>This example was worked \
fine to me on ITK 3.20, before my version upgrade. \
</div><div><br></div><div>Regards,</div><div><br></div><div>Wagner \
Sales</div><div><br>
</div><div><br></div><div><br></div></div>
</blockquote></div><br></div>
_____________________________________
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic