[Insight-users] Compressing Tif files

Fethallah fethallah at gmail.com
Fri Dec 20 10:35:59 EST 2013


Hi there,

I would like to compress some relatively large tif files.

My code looks like:
=================
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
reader->Update();

WriterType::Pointer writer = WriterType::New();
writer->SetInput( reader->GetOutput() );
writer->SetFileName( argv[2] );
writer->SetUseCompression(true);
typedef  itk::TIFFImageIO TIFFIOType;
TIFFIOType::Pointer tiffIO = TIFFIOType::New();
tiffIO->SetCompressionToJPEG();
writer->SetImageIO(tiffIO);
writer->Update();
=================
when I run
binary.exe Image.tif ImageCompressed.tif

I'm getting the following exception:
JPEGLib: Bogus input colorspace.
itk::ExceptionObject (000000000012F6E8)
Location: "unknown"
File:
..\..\..\..\..\src\InsightToolkit-4.4.2\Modules\IO\TIFF\src\itkTIFFImageIO.cxx
Line: 1946
Description: itk::ERROR: TIFFImageIO(00000000020D4420): TIFFImageIO: error
out of disk space


The pixel type of the input images is UCHAR.

An other question regarding JPG compression in TIF files, assuming this
works with ITK.
Is there a way to control the compression rate ?

Thanks into advance for your help.


--
Fethallah




--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Compressing-Tif-files-tp7584685.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list