[Insight-users] questions on region reallocation

Luis Ibanez luis.ibanez at kitware.com
Mon Apr 14 17:01:52 EDT 2008


Hi Quan,

1) Are you reading the image from a file ?
    or creating it directly in memory ?

2) How are you passing this ITK image to
    the vtkImageData ?


If you are using ITK readers, they will take
care of resizing the image regions appropriately.


--

In order to detect whether an image is color or
grayscale, at read time, you could get the ImageIO
object from the ImageFileReader, and call on it
the method GetNumberOfComponents.

Something like:


     reader->GetImageIO()->GetNumberOfComponents();

A color image will return 3, while a grayscale
image will return 1.



    Regards,


       Luis


------------------------
qxue at jouy.inra.fr wrote:
> Hello, every one,
>     My program consists of ITK for segmentation and VTK for visualization. Until
> now, I know that one bug occurs from memory allocation for different regions
> with the help of Gaetan.
>     I find a method to avoid it, that is, If I give a bigger memory in the
> initialization of program for image or volume, the tool runs correctly. Of
> course, this is not a good way to fix these bugs.
>     Is ITK possible to reallocate memory for different region automatically as a
> user? or I have to write new filters to change the region manually according to
> my application?
>     How to detect whether an image is color image or gray image?
> Quan
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 


More information about the Insight-users mailing list