[Insight-users] Problem with reading binary image

Xiu xjiang01 at hotmail.com
Wed Mar 30 15:12:32 EDT 2011


David Doria-2 wrote:
> 
> On Wed, Mar 30, 2011 at 2:04 PM, xiu jiang <xjiang01 at hotmail.com>
> wrote:
> 
>>
>> Hi, all
>>
>> I'm trying to read TIFF image which contains the pixel value of only 1
>> and
>> 0 and use it as a binary image. But I found the pixel  value is changed
>> from
>> 1 and 0 to 198 and 160 after I read it. Is there anybody who can tell me
>> how
>> to fix this problem? below is the code.
>>
>> typedef itk::ImageFileReader< ImageType > ReaderType;
>> ReaderType::Pointer reader = ReaderType::New();
>> std::string filename = inputDirectoryName;
>> reader->SetFileName( filename );
>> reader->Update();
>> return reader->GetOutput();;
>>
>> Thanks,
>> Xiu
>>
> 
> What is your ImageType?
> 
> David
> 
> _____________________________________
> 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.html
> 
> 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
> 
ImageType is set as 3D short

typedef unsigned short PixelType;
const unsigned int Dimension = 3;
typedef itk::Image< PixelType, Dimension >  ImageType;

Xiu

--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Problem-with-reading-binary-image-tp6224343p6224565.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list