[Insight-users] Compressing Tif files

Bill Lorensen bill.lorensen at gmail.com
Fri Dec 20 11:24:41 EST 2013


Ok, I can reproduce the error with my sample code. I have to add
writer->UseCompressionOn().

I think that also points out an error…

Now I can debug.


On Fri, Dec 20, 2013 at 11:17 AM, Fethallah Benmansour
<fethallah at gmail.com>wrote:

> Hi Bill,
>
> Thanks again.
> Your code works indeed, however the output image is not JPEG compressed as
> it should be:
>
> [image: Inline image 1]
>
>
> Thanks for your help.
>
> --
> Fethallah
>
> --
> Fethallah
>
>
> On Fri, Dec 20, 2013 at 5:06 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
>
>> Can you try this program:
>>
>> On Fri, Dec 20, 2013 at 11:03 AM, Fethallah Benmansour
>> <fethallah at gmail.com> wrote:
>> > 4.4.2
>> > Let me know if you need more info, I can also send you my cxx and my
>> > CMakelists.txt
>> >
>> > Thanks,
>> >
>> > --
>> > Fethallah
>> >
>> > --
>> > Fethallah
>> >
>> >
>> > On Fri, Dec 20, 2013 at 4:59 PM, Bill Lorensen <bill.lorensen at gmail.com
>> >
>> > wrote:
>> >>
>> >> What version of ITK are you using?
>> >>
>> >>
>> >> On Fri, Dec 20, 2013 at 10:56 AM, Fethallah Benmansour
>> >> <fethallah at gmail.com> wrote:
>> >> > Thanks Bill for your prompt reply.
>> >> > I'm looking forward to hearing from you.
>> >> >
>> >> > --
>> >> > Fethallah
>> >> >
>> >> > --
>> >> > Fethallah
>> >> >
>> >> >
>> >> > On Fri, Dec 20, 2013 at 4:50 PM, Bill Lorensen <
>> bill.lorensen at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> I do not see any tests that use tiff compression. You may have
>> founds
>> >> >> a bug. I'll investigate.
>> >> >>
>> >> >>
>> >> >> On Fri, Dec 20, 2013 at 10:35 AM, Fethallah <fethallah at gmail.com>
>> >> >> wrote:
>> >> >> > 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.
>> >> >> > _____________________________________
>> >> >> > 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
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Unpaid intern in BillsBasement at noware dot com
>> >
>> >
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>>
>
>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20131220/af41d0ab/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 68232 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20131220/af41d0ab/attachment-0001.jpeg>


More information about the Insight-users mailing list