[Insight-users] Weird behavior fo itk::Image<>::RegionType

Ho Cheung hocheung20 at gmail.com
Wed Aug 21 08:26:41 EDT 2013


I'm not familiar with that editor so I'm in no authoritative position to
say whether or not it the Nsight Eclipse is the problem.

At this point, with two people unable to reproduce the problem, I'd suggest
trying the time-tested make tools to see if it will build. If it checks out
fine using GNU make, then I'd look hard at your project settings in Nsight
Eclipse editor if you elect to continue to try to use that editor.

Ho Cheung
hocheung20 at gmail.com
Cell: (775) 388-2368


On Wed, Aug 21, 2013 at 6:55 AM, Gabriel Santiago <
santiago.eletrica at gmail.com> wrote:

> No, I am not... I am using Nsight Eclipse as editor. Could this be a
> problem?
> I am running on the lattest update of Linux...
>
>
>
> On 20 August 2013 22:05, Ho Cheung <hocheung20 at gmail.com> wrote:
>
>> That code compiles for me on exactly the same platform as you have
>> mentioned. Are you embedding this in a larger piece of code?
>>
>> hocheung20 at hocheung20-VirtualBox:~/ITK-RegionType/bin$ lsb_release -a
>> No LSB modules are available.
>> Distributor ID:    Ubuntu
>> Description:    Ubuntu 12.04.2 LTS
>> Release:    12.04
>> Codename:    precise
>> hocheung20 at hocheung20-VirtualBox:~/ITK-RegionType/bin$ gcc -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
>> 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
>> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
>> --program-suffix=-4.6 --enable-shared --enable-linker-build-id
>> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
>> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
>> --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
>> --enable-libstdcxx-debug --enable-libstdcxx-time=yes
>> --enable-gnu-unique-object --enable-plugin --enable-objc-gc
>> --disable-werror --with-arch-32=i686 --with-tune=generic
>> --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
>> --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>> hocheung20 at hocheung20-VirtualBox:~/ITK-RegionType/bin$ make -j12
>> [100%] Built target itk_region_type
>> hocheung20 at hocheung20-VirtualBox:~/ITK-RegionType/bin$
>>
>>
>> Ho Cheung
>> hocheung20 at gmail.com
>> Cell: (775) 388-2368
>>
>>
>> On Mon, Aug 19, 2013 at 7:30 AM, Gabriel Santiago <
>> santiago.eletrica at gmail.com> wrote:
>>
>>> Hello,
>>>
>>> Thank you for your reply!
>>>
>>> I am using Linux (Ubuntu 12.04) and gcc version 4.6.3 and Insight
>>> Toolkit 4.2.1.
>>>
>>> Thanks,
>>>
>>>
>>>
>>> On 16 August 2013 17:57, Ho Cheung <hocheung20 at gmail.com> wrote:
>>>
>>>> Hi Gabriel,
>>>>
>>>> Could you describe your platform more?
>>>>
>>>> Windows? Mac? Linux?
>>>> Compiler version(s)?
>>>>
>>>> Thanks,
>>>>
>>>>   Ho Cheung
>>>>
>>>> On Aug 16, 2013, at 3:29 PM, Gabriel Santiago <
>>>> santiago.eletrica at gmail.com> wrote:
>>>>
>>>> Could be an ITK version problem? It doens't work for me no matter what
>>>> I do!
>>>>
>>>>
>>>> On 16 August 2013 17:26, Matt McCormick <matt.mccormick at kitware.com>wrote:
>>>>
>>>>> Hi Gabriel,
>>>>>
>>>>> Your program compiles for me.
>>>>>
>>>>> HTH,
>>>>> Matt
>>>>>
>>>>>
>>>>> On Fri, Aug 16, 2013 at 7:45 PM, Gabriel Santiago <
>>>>> santiago.eletrica at gmail.com> wrote:
>>>>>
>>>>>> The weirdest thing is, if I replace the variables *
>>>>>> desiredRegion.SetSize(size)* and* desiredRegion.SetIndex(start)*inside for
>>>>>> * **desiredRegion.SetSize(inputRegion.GetSize()*) and *
>>>>>> desiredRegion.SetIndex(**inputRegion.GetIndex()*) respectively, it
>>>>>> doesn't appear the error message and the program compiles just fine.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 16 August 2013 16:32, Gabriel Santiago <
>>>>>> santiago.eletrica at gmail.com> wrote:
>>>>>>
>>>>>>> Sorry, but where you read
>>>>>>>
>>>>>>>
>>>>>>> *typedef itk::Image<InputAnalyzeImage, 3> Image3D;
>>>>>>> *
>>>>>>> *typedef itk::Image<OutputJPGImage, 2> Image2D;*
>>>>>>>
>>>>>>> Please, read
>>>>>>>
>>>>>>> *typedef itk::Image<InputImage, 3> Image3D;
>>>>>>> *
>>>>>>> *typedef itk::Image<OutputImage, 2> Image2D;*
>>>>>>>
>>>>>>> and
>>>>>>>
>>>>>>>
>>>>>>> *typedef itk::ImageFileReader<**Analyze3DImage> Reader3D;
>>>>>>> typedef itk::ImageFileWriter<**JPG2DImage> Writer2D;
>>>>>>>
>>>>>>> *
>>>>>>> read*
>>>>>>> *
>>>>>>>
>>>>>>> *typedef itk::ImageFileReader<**Image3D> Reader3D;
>>>>>>> typedef itk::ImageFileWriter<Image2D**> Writer2D;*
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 16 August 2013 16:26, Gabriel Santiago <
>>>>>>> santiago.eletrica at gmail.com> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> Here it is:
>>>>>>>> *
>>>>>>>> // STD libraries:
>>>>>>>> #include <iostream>
>>>>>>>> #include <string>
>>>>>>>> // ITK libraries:
>>>>>>>> #include "itkImage.h"
>>>>>>>> #include "itkImageFileReader.h"
>>>>>>>> #include "itkImageFileWriter.h"
>>>>>>>> #include "itkExtractImageFilter.h"
>>>>>>>> #include "itkAnalyzeImageIO.h"
>>>>>>>> #include "itkOrientImageFilter.h"
>>>>>>>> #include "itkSize.h"
>>>>>>>>
>>>>>>>> *
>>>>>>>> *// Type def.
>>>>>>>> *
>>>>>>>> *typedef unsigned char InputImage;
>>>>>>>> typedef unsigned char OutputImage;
>>>>>>>>
>>>>>>>> // Image def.::
>>>>>>>>
>>>>>>>> typedef itk::Image<InputAnalyzeImage, 3> Image3D;
>>>>>>>> typedef itk::Image<OutputJPGImage, 2> Image2D;
>>>>>>>>
>>>>>>>> typedef itk::ImageFileReader<**Analyze3DImage> Reader3D;
>>>>>>>> typedef itk::ImageFileWriter<**JPG2DImage> Writer2D;
>>>>>>>> typedef itk::ExtractImageFilter<**Image3D, Image2D> Filter3D;
>>>>>>>>
>>>>>>>> Image2D::Pointer extract2DSlice(Image3D::**Pointer buffer, int
>>>>>>>> plane, int slice)
>>>>>>>> {
>>>>>>>>     Filter3D::Pointer filter = Filter3D::New();
>>>>>>>>     Image3D::RegionType inputRegion = buffer->**
>>>>>>>> GetLargestPossibleRegion();
>>>>>>>>
>>>>>>>>
>>>>>>>>     Image3D::SizeType size = inputRegion.GetSize();
>>>>>>>>     size[plane] = 0;
>>>>>>>>     Image3D::IndexType start = inputRegion.GetIndex();
>>>>>>>>     const unsigned int sliceNumber = slice;
>>>>>>>>     start[plane] = sliceNumber;
>>>>>>>>
>>>>>>>> *
>>>>>>>> *    // The problem is HERE!
>>>>>>>> *
>>>>>>>> *
>>>>>>>>     Image3D::RegionType desiredRegion;
>>>>>>>>     desiredRegion.SetSize(size);
>>>>>>>>     desiredRegion.SetIndex(start);
>>>>>>>>
>>>>>>>>     filter->SetExtractionRegion(**desiredRegion);
>>>>>>>>     filter->SetInput(buffer);
>>>>>>>>
>>>>>>>>     Image2D::Pointer img = filter->GetOutput();
>>>>>>>>     return img;
>>>>>>>> }*
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 16 August 2013 16:21, Bill Lorensen <bill.lorensen at gmail.com>wrote:
>>>>>>>>
>>>>>>>>> If you post a small, minimal example that with all includes,
>>>>>>>>> perhaps we can help.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, Aug 16, 2013 at 3:17 PM, Gabriel Santiago <
>>>>>>>>> santiago.eletrica at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Dear all,
>>>>>>>>>>
>>>>>>>>>> I am trying to reproduce the example of page 118, of the
>>>>>>>>>> itkSoftwareGuide, changing
>>>>>>>>>>
>>>>>>>>>> *typedef itk::ImageMaskSpatialObject<3> ImageMaskSpatialObject;*
>>>>>>>>>>
>>>>>>>>>> to
>>>>>>>>>>
>>>>>>>>>> *typedef itk::Image<InputAnalyzeImage, 3> Image3D;*
>>>>>>>>>>
>>>>>>>>>> I think it should work, but when I come to the following lines
>>>>>>>>>>
>>>>>>>>>> *    Image3D::SizeType size = inputRegion.GetSize();
>>>>>>>>>>     size[plane] = 0;
>>>>>>>>>>     Image3D::IndexType start = inputRegion.GetIndex();
>>>>>>>>>>     const unsigned int sliceNumber = slice;
>>>>>>>>>>     start[plane] = sliceNumber;
>>>>>>>>>>
>>>>>>>>>>     Image3D::RegionType desiredRegion;
>>>>>>>>>>     desiredRegion.SetSize(size);
>>>>>>>>>>     desiredRegion.SetIndex(start);*
>>>>>>>>>>
>>>>>>>>>> I am getting the following error messages:
>>>>>>>>>>
>>>>>>>>>> *Invalid argumentes:
>>>>>>>>>> *
>>>>>>>>>> *Candidates are:
>>>>>>>>>> *
>>>>>>>>>> *void SetSize(const itk::Size<<unknown>>&)  and
>>>>>>>>>> void SetSize(unsigned long int, unsigned long int)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Invalid argumentes:
>>>>>>>>>> Candidates are:
>>>>>>>>>> void SetIndex(const itk::Index<<unknown>>&)  and
>>>>>>>>>> void SetIndex(unsigned long int, unsigned long int)
>>>>>>>>>> *
>>>>>>>>>>
>>>>>>>>>> Can anyone, please, help me? I am using itk v4.2.
>>>>>>>>>> What is going on?
>>>>>>>>>>
>>>>>>>>>> Thanks in advance,
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Gabriel Santiago
>>>>>>>>>>
>>>>>>>>>> ~"As long as I live so long do I learn"~
>>>>>>>>>> Ramakhrishna
>>>>>>>>>>
>>>>>>>>>> _____________________________________
>>>>>>>>>> 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://www.itk.org/mailman/listinfo/insight-users
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Unpaid intern in BillsBasement at noware dot com
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Gabriel Santiago
>>>>>>>> Engenheiro de Computação - Serviço de Informática/ Hospital das
>>>>>>>> Clínicas de São Paulo
>>>>>>>> santiago.eletrica at gmail.com
>>>>>>>> Cel.: +55 11 99801-0881
>>>>>>>>
>>>>>>>>
>>>>>>>> ~"As long as I live so long do I learn"~
>>>>>>>> Ramakhrishna
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Gabriel Santiago
>>>>>>>
>>>>>>> ~"As long as I live so long do I learn"~
>>>>>>> Ramakhrishna
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Gabriel Santiago
>>>>>>
>>>>>> ~"As long as I live so long do I learn"~
>>>>>> Ramakhrishna
>>>>>>
>>>>>> _____________________________________
>>>>>> 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://www.itk.org/mailman/listinfo/insight-users
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Gabriel Santiago
>>>>
>>>> ~"As long as I live so long do I learn"~
>>>> Ramakhrishna
>>>>  _____________________________________
>>>> 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://www.itk.org/mailman/listinfo/insight-users
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Gabriel Santiago
>>>
>>> ~"As long as I live so long do I learn"~
>>> Ramakhrishna
>>>
>>
>>
>
>
> --
> Gabriel Santiago
>
> ~"As long as I live so long do I learn"~
> Ramakhrishna
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130821/c4fa5c0d/attachment.htm>


More information about the Insight-users mailing list