<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4207.2601" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi,</FONT></DIV>
<DIV><FONT size=2>Thank you very much. The vtkTIFF16Writer class is working
perfectly. However, why the need for a new class? The changes are limited and it
should be easy to just incorporate them inside the vtkTIFFWriter class with
automatic checking of the data type!!</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Thanks again,</FONT></DIV>
<DIV><FONT size=2>Asad</FONT></DIV>
<DIV><FONT size=2></FONT><BR> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=hhiraki@lab.nig.ac.jp href="mailto:hhiraki@lab.nig.ac.jp">HIRAKI
Hideaki</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=tarifa@rpi.edu
href="mailto:tarifa@rpi.edu">Asad A. Abu-Tarif</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=vtkusers@public.kitware.com
href="mailto:vtkusers@public.kitware.com">vtkusers@public.kitware.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, October 29, 2000 8:25
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [vtkusers] Writing Image
Slices with unsigned short data type</DIV>
<DIV><BR></DIV>At Sat 28 Oct 2000 13:33:19 +0200, Sebastien BARRE
wrote:<BR>>At 28/10/00 06:07, Asad A. Abu-Tarif
wrote:<BR>><BR>>>Is there any Image writer that takes
vtkStructuredPoints as its input and <BR>>>writes the image slices to
standart image format(s)? I found vtkBMPWriter <BR>>>and vtkTIFFWriter,
however, these deal only with unsigned char input type. <BR>>>My data is
2 bytes long (unsigned short) and hence I need some other image
<BR>>>writer.<BR>><BR>>BMP won't support unsigned short
anyway.<BR>>The TIFF format does, theoritically. I do remember that the
TIFF reader is <BR>>able to read 16 bits data, si I guess the writer does
the same. Try this <BR>>out, and test the result with Photoshop for example
(which is able to <BR>>handle 16 bits).<BR><BR>As vtkTIFFWriter didn't
support 16 bits data, I made vtkTIFF16Writer <BR>tweaking vtkTIFFWriter. The
modifications are shown below. I hope <BR>this helps.<BR><BR><BR>% diff
imaging/vtkTIFFWriter.h local/vtkTIFF16Writer.h<BR>42c42<BR>< // .NAME
vtkTIFFWriter - write out structured points as a TIFF file<BR>---<BR>> //
.NAME vtkTIFF16Writer - write out structured points as a TIFF
file<BR>46,47c46,47<BR>< #ifndef __vtkTIFFWriter_h<BR>< #define
__vtkTIFFWriter_h<BR>---<BR>> #ifndef __vtkTIFF16Writer_h<BR>> #define
__vtkTIFF16Writer_h<BR>52c52<BR>< class VTK_EXPORT vtkTIFFWriter : public
vtkImageWriter<BR>---<BR>> class VTK_EXPORT vtkTIFF16Writer : public
vtkImageWriter<BR>55,56c55,56<BR>< static vtkTIFFWriter
*New();<BR><
vtkTypeMacro(vtkTIFFWriter,vtkImageWriter);<BR>---<BR>> static
vtkTIFF16Writer *New();<BR>>
vtkTypeMacro(vtkTIFF16Writer,vtkImageWriter);<BR>59,62c59,62<BR><
vtkTIFFWriter() {};<BR>< ~vtkTIFFWriter()
{};<BR>< vtkTIFFWriter(const vtkTIFFWriter&)
{};<BR>< void operator=(const vtkTIFFWriter&)
{};<BR>---<BR>> vtkTIFF16Writer() {};<BR>>
~vtkTIFF16Writer() {};<BR>> vtkTIFF16Writer(const
vtkTIFF16Writer&) {};<BR>> void operator=(const
vtkTIFF16Writer&) {};<BR><BR><BR>% diff imaging/vtkTIFFWriter.cxx
local/vtkTIFF16Writer.cxx<BR>42c42<BR>< #include
"vtkTIFFWriter.h"<BR>---<BR>> #include "vtkTIFF16Writer.h"<BR>55c55<BR><
vtkTIFFWriter* vtkTIFFWriter::New()<BR>---<BR>> vtkTIFF16Writer*
vtkTIFF16Writer::New()<BR>58c58<BR>< vtkObject* ret =
vtkObjectFactory::CreateInstance("vtkTIFFWriter");<BR>---<BR>>
vtkObject* ret =
vtkObjectFactory::CreateInstance("vtkTIFF16Writer");<BR>61c61<BR><
return (vtkTIFFWriter*)ret;<BR>---<BR>> return
(vtkTIFF16Writer*)ret;<BR>66c66<BR><
vtkGenericWarningMacro ("vtkTIFFWriter expects sizeof(vtkTiffLong) to be
4,"<BR>---<BR>> vtkGenericWarningMacro
("vtkTIFF16Writer expects sizeof(vtkTiffLong) to be
4,"<BR>70c76<BR>< return new
vtkTIFFWriter;<BR>---<BR>> return new
vtkTIFF16Writer;<BR>285c291<BR>< void
vtkTIFFWriter::WriteFileHeader(ofstream *file, vtkImageData
*cache)<BR>---<BR>> void vtkTIFF16Writer::WriteFileHeader(ofstream *file,
vtkImageData *cache)<BR>357c363<BR><
short depth = 8;<BR>---<BR>> short
depth = 16;<BR>362c368<BR><
vtkTiffUnsignedLong depth = 8 + (8 <<
16);<BR>---<BR>> vtkTiffUnsignedLong
depth = 16 + (16 << 16);<BR>421c427<BR>< vtkTiffLong
stripByteCounts = width*height*bpp;<BR>---<BR>> vtkTiffLong
stripByteCounts = width*height*bpp*2;<BR>469c475<BR>< short
depth = 8;<BR>---<BR>> short depth = 16;<BR>483c489<BR><
void vtkTIFFWriter::WriteFile(ofstream *file, vtkImageData
*data,<BR>---<BR>> void vtkTIFF16Writer::WriteFile(ofstream *file,
vtkImageData *data,<BR>500,501c506,507<BR>< case
VTK_UNSIGNED_CHAR:<BR>< rowLength =
sizeof(unsigned char); <BR>---<BR>> case
VTK_UNSIGNED_SHORT:<BR>> rowLength =
sizeof(unsigned short);
<BR>504c510<BR><
vtkErrorMacro("TIFFWriter only accepts unsigned char
scalars!");<BR>---<BR>>
vtkErrorMacro("TIFF16Writer only accepts unsigned short
scalars!");<BR></BLOCKQUOTE></BODY></HTML>