<div dir="ltr">This is strange. The compression works for me.<div><br></div><div>I will eventually add the quality parameter. But I need to resolve the compression issue first.</div><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Dec 23, 2013 at 4:30 AM, Fethallah Benmansour <span dir="ltr">&lt;<a href="mailto:fethallah@gmail.com" target="_blank">fethallah@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Bill,<div><br></div><div>I hope you had a great weekend.</div><div>I followed the modification you suggested (and rebuild ITK of course). Unfortunately, the output images are still uncompressed.</div><div>

<br></div><div>In addition, close to the line you mentioned, I can see:</div><div><br></div><div>TIFFSetField(tif, TIFFTAG_JPEGQUALITY, 75); // Parameter<br></div><div><br></div><div>Could you please add that as a parameter of itkTIFFImageIO in you gerrit patch ?</div>

<div><br></div><div>Kind regards,</div><div><br></div><div><div>--</div>Fethallah</div><div><div class="h5"><div><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Dec 20, 2013 at 5:52 PM, Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr">I found the first problem. I will submit a gerrit patch when I resolve the other issues and make a test.<div><br></div><div>Try this. In itkTIFFImageIO.cxx delete  line 1847 which contains:</div><div>      photometric = PHOTOMETRIC_YCBCR;<br>


</div><div><br></div><div>Let me know if your data compresses.</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 20, 2013 at 11:24 AM, Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Ok, I can reproduce the error with my sample code. I have to add writer-&gt;UseCompressionOn().<div>

<br>
</div><div>I think that also points out an error…</div><div><br></div><div>Now I can debug.</div></div><div><div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 20, 2013 at 11:17 AM, Fethallah Benmansour <span dir="ltr">&lt;<a href="mailto:fethallah@gmail.com" target="_blank">fethallah@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Bill,<div><br></div><div>Thanks again.</div>

<div>Your code works indeed, however the output image is not JPEG compressed as it should be:</div>

<div><br></div><div><img src="cid:ii_14310cbf040993f8" alt="Inline image 1"><br>
</div><div><br></div><div><br></div><div>Thanks for your help.</div><div><br></div><div>--</div><div>Fethallah</div></div><div class="gmail_extra"><br clear="all"><div><div>--</div>Fethallah <br></div><div><div>

<br><br><div class="gmail_quote">On Fri, Dec 20, 2013 at 5:06 PM, Bill Lorensen <span dir="ltr">&lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">




Can you try this program:<br>
<br>
On Fri, Dec 20, 2013 at 11:03 AM, Fethallah Benmansour<br>
<div><div>&lt;<a href="mailto:fethallah@gmail.com" target="_blank">fethallah@gmail.com</a>&gt; wrote:<br>
&gt; 4.4.2<br>
&gt; Let me know if you need more info, I can also send you my cxx and my<br>
&gt; CMakelists.txt<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; --<br>
&gt; Fethallah<br>
&gt;<br>
&gt; --<br>
&gt; Fethallah<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Dec 20, 2013 at 4:59 PM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; What version of ITK are you using?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Fri, Dec 20, 2013 at 10:56 AM, Fethallah Benmansour<br>
&gt;&gt; &lt;<a href="mailto:fethallah@gmail.com" target="_blank">fethallah@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; Thanks Bill for your prompt reply.<br>
&gt;&gt; &gt; I&#39;m looking forward to hearing from you.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Fethallah<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; Fethallah<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Fri, Dec 20, 2013 at 4:50 PM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I do not see any tests that use tiff compression. You may have founds<br>
&gt;&gt; &gt;&gt; a bug. I&#39;ll investigate.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Fri, Dec 20, 2013 at 10:35 AM, Fethallah &lt;<a href="mailto:fethallah@gmail.com" target="_blank">fethallah@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt; Hi there,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I would like to compress some relatively large tif files.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; My code looks like:<br>
&gt;&gt; &gt;&gt; &gt; =================<br>
&gt;&gt; &gt;&gt; &gt; ReaderType::Pointer reader = ReaderType::New();<br>
&gt;&gt; &gt;&gt; &gt; reader-&gt;SetFileName( argv[1] );<br>
&gt;&gt; &gt;&gt; &gt; reader-&gt;Update();<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; WriterType::Pointer writer = WriterType::New();<br>
&gt;&gt; &gt;&gt; &gt; writer-&gt;SetInput( reader-&gt;GetOutput() );<br>
&gt;&gt; &gt;&gt; &gt; writer-&gt;SetFileName( argv[2] );<br>
&gt;&gt; &gt;&gt; &gt; writer-&gt;SetUseCompression(true);<br>
&gt;&gt; &gt;&gt; &gt; typedef  itk::TIFFImageIO TIFFIOType;<br>
&gt;&gt; &gt;&gt; &gt; TIFFIOType::Pointer tiffIO = TIFFIOType::New();<br>
&gt;&gt; &gt;&gt; &gt; tiffIO-&gt;SetCompressionToJPEG();<br>
&gt;&gt; &gt;&gt; &gt; writer-&gt;SetImageIO(tiffIO);<br>
&gt;&gt; &gt;&gt; &gt; writer-&gt;Update();<br>
&gt;&gt; &gt;&gt; &gt; =================<br>
&gt;&gt; &gt;&gt; &gt; when I run<br>
&gt;&gt; &gt;&gt; &gt; binary.exe Image.tif ImageCompressed.tif<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; I&#39;m getting the following exception:<br>
&gt;&gt; &gt;&gt; &gt; JPEGLib: Bogus input colorspace.<br>
&gt;&gt; &gt;&gt; &gt; itk::ExceptionObject (000000000012F6E8)<br>
&gt;&gt; &gt;&gt; &gt; Location: &quot;unknown&quot;<br>
&gt;&gt; &gt;&gt; &gt; File:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; ..\..\..\..\..\src\InsightToolkit-4.4.2\Modules\IO\TIFF\src\itkTIFFImageIO.cxx<br>
&gt;&gt; &gt;&gt; &gt; Line: 1946<br>
&gt;&gt; &gt;&gt; &gt; Description: itk::ERROR: TIFFImageIO(00000000020D4420): TIFFImageIO:<br>
&gt;&gt; &gt;&gt; &gt; error<br>
&gt;&gt; &gt;&gt; &gt; out of disk space<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; The pixel type of the input images is UCHAR.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; An other question regarding JPG compression in TIF files, assuming<br>
&gt;&gt; &gt;&gt; &gt; this<br>
&gt;&gt; &gt;&gt; &gt; works with ITK.<br>
&gt;&gt; &gt;&gt; &gt; Is there a way to control the compression rate ?<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Thanks into advance for your help.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; --<br>
&gt;&gt; &gt;&gt; &gt; Fethallah<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; --<br>
&gt;&gt; &gt;&gt; &gt; View this message in context:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://itk-insight-users.2283740.n2.nabble.com/Compressing-Tif-files-tp7584685.html" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/Compressing-Tif-files-tp7584685.html</a><br>





&gt;&gt; &gt;&gt; &gt; Sent from the ITK Insight Users mailing list archive at Nabble.com.<br>
&gt;&gt; &gt;&gt; &gt; _____________________________________<br>
&gt;&gt; &gt;&gt; &gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Visit other Kitware open-source projects at<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; &gt;&gt; &gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; Unpaid intern in BillsBasement at noware dot com<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Unpaid intern in BillsBasement at noware dot com<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>