[Insight-users] About reconstruction of gray-scaled image from binary image

Lodron, Gerald Gerald.Lodron at joanneum.at
Mon Jan 4 03:26:20 EST 2010


Ok, here some tipps and workflow hints:

Google and type itk::image then you will find this in the help:

itk::Image< TPixel, VImageDimension > 

So you must use

Itk::Image<bool, 2>::Pointer myBooleanImage = itk::Image<bool,2>::New();

To initiate a new image.
If you google itk::ConnectedThresholdImageFilter you will find

itk::ConnectedThresholdImageFilter < TInputImage, TOutputImage >

So you must use

itk::ConnectedThresholdImageFilter < itk::Image<bool, 2>, itk::Image<bool,2>>::Pointer myFilter = itk::ConnectedThresholdImageFilter < itk::Image<bool, 2>, itk::Image<bool,2>>::New();

If you have an int image and want a boolean image as output you can also use

itk::ConnectedThresholdImageFilter < itk::Image<int, 2>, itk::Image<bool,2>>::Pointer myFilter = itk::ConnectedThresholdImageFilter < itk::Image<int, 2>, itk::Image<bool,2>>::New();

//Now you only need to set the input and output see pipeline for further help

myFilter->SetInput(myNormalIntImage);
...
myBooleanImage = myFilter->GetOutput();

Thats all



-----Ursprüngliche Nachricht-----
Von: Xiaopeng Yang [mailto:yxp233 at postech.ac.kr] 
Gesendet: Montag, 04. Jänner 2010 09:16
An: Lodron, Gerald
Betreff: RE: About reconstruction of gray-scaled image from binary image

Dear Gerald,

Thank you very much. Still I have no idea about how to specify the template image as boolean image due to my limited knowledge. I attached my code, could you please help me to fix it?

Thank you very much again!

Xiaopeng Yang

-----Original Message-----
From: Lodron, Gerald [mailto:Gerald.Lodron at joanneum.at]
Sent: Monday, January 04, 2010 4:58 PM
To: Xiaopeng Yang
Subject: AW: About reconstruction of gray-scaled image from binary image


You do not need to change the SetReplaceValue, it is default set to one. The
casting of (int)1 to bool is true ( int a=1; bool b=a; //b will be true).
But it will also work for 100 (int a = 100; bool b=a; //b will be also
true). The only thing to do is specifying the template image as boolean
image.

Best regards

-----Ursprüngliche Nachricht-----
Von: Xiaopeng Yang [mailto:yxp233 at postech.ac.kr] 
Gesendet: Montag, 04. Jänner 2010 03:46
An: Lodron, Gerald
Betreff: RE: About reconstruction of gray-scaled image from binary image

Dear Gerald,

Thank you for your help. Since I am not very familiar with ITK, I have no
idea about how to use as template parameter a grayscale image instead of a
binary image. Do you mean changing the SetReplaceValue? If I set the
SetReplaceValue as 100, then all the pixel value in the image will be 100,
which is not what I want.

What I would like to get is the region growing output image which has the
same pixel values with respect to the input image at the same pixel. 

Thank you very much!

Xiaopeng Yang

-----Original Message-----
From: Lodron, Gerald [mailto:Gerald.Lodron at joanneum.at]
Sent: Tuesday, December 22, 2009 5:35 PM
To: Xiaopeng Yang
Cc: insight-users at itk.org
Subject: AW: About reconstruction of gray-scaled image from binary image


Hi

Use as template parameter a grayscale image instead of a binary image. The
function SetReplaceValue specifies the gray value (default is 1 or true in
binary images)

Best regards

 

-----Ursprüngliche Nachricht-----
Von: Xiaopeng Yang [mailto:yxp233 at postech.ac.kr] 
Gesendet: Dienstag, 22. Dezember 2009 01:53
An: 'Luis Ibanez'; Lodron, Gerald
Cc: insight-users at itk.org
Betreff: About reconstruction of gray-scaled image from binary image

Hi,

I am working on liver segmentation from a series of gray-scaled CT images. I
used ConnectedThresholdImageFilter.cxx region growing algorithm and obtained
a series of binary images. What I would like to do is to change the region
growing binary images to gray-scaled images. How can ITK solve this problem?

Thank you very much.

Xiaopeng Yang

POSTECH,
South Korea

























More information about the Insight-users mailing list