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

Gabriel Santiago santiago.eletrica at gmail.com
Fri Aug 16 16:29:12 EDT 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130816/a3ed1000/attachment.htm>


More information about the Insight-users mailing list