<DIV>hi Bruno,</DIV>
<DIV> </DIV>
<DIV>I used vtkPNGWriter instead of vtkJPEGWriter, but still the final image complete black !</DIV>
<DIV> </DIV>
<DIV>what could be wrong ?</DIV>
<DIV> </DIV>
<DIV>Thank you,</DIV>
<DIV>Ravi<BR><BR><B><I>Bruno da Silva de Oliveira <bruno@esss.com.br></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Hi,<BR><BR>Didn't actually read your code, but what happens if you use a <BR>vtkPNGWriter instead? Does the resulting image look correct?<BR><BR>Regards,<BR><BR>Ravi Samala wrote:<BR><BR>> Dear /VTKUser's/,<BR>><BR>> <BR>><BR>> *Objective*: To write some data to a JPEG file.<BR>><BR>> *Problem*: The final image is black color !<BR>><BR>> <BR>><BR>> <BR>><BR>> The code is as follows:<BR>><BR>> <BR>><BR>> //****************************************************<BR>><BR>> // ***** Used to read 16 bit Image *****<BR>><BR>> //****************************************************<BR>><BR>> *vtkVolume16Reader *v16Img = vtkVolume16Reader::New(); *<BR>><BR>> v16Img->SetDataDimensions (sizex,sizey);<BR>><BR>> v16Img->SetImageRange (atoi(argv[3]),atoi(argv[4]));//Specify <BR>> the number of slices to
read<BR>><BR>> v16Img->SetHeaderSize(HeadS); // Specify the number of bytes to <BR>> seek over at start of image<BR>><BR>> v16Img->SetFilePrefix (argv[2]); //Specify the File prefix of <BR>> all the slices (files)<BR>><BR>> v16Img->SetDataSpacing (0.1, 0.1, 0.5); <BR>> //Resolution along X, Y and Z axis<BR>><BR>> v16Img->SetDataOrigin(0, 0, 0);<BR>><BR>> <BR>><BR>> //****************************************************<BR>><BR>> // ***** Extracting a slice from the 3D volume *****<BR>><BR>> //****************************************************<BR>><BR>> *vtkImageReslice *imgResliceIn = vtkImageReslice::New(); *<BR>><BR>> imgResliceIn->SetInput(v16Img -> GetOutput());<BR>><BR>> imgResliceIn->SetOutputSpacing(1,1,1);<BR>><BR>> imgResliceIn->SetInterpolationModeToLinear();<BR>><BR>> imgResliceIn->SetOutputOrigin(0, 0, 10);<BR>><BR>>
imgResliceIn->SetOutputExtent(0,312,0,499,0,0);<BR>><BR>> <BR>><BR>> //****************************************************<BR>><BR>> // ***** Scaling the pixel range ******<BR>><BR>> //****************************************************<BR>><BR>> *vtkImageShiftScale *imgShSc =vtkImageShiftScale::New();*<BR>><BR>> imgShSc->SetInput(imgResliceIn -> GetOutput());<BR>><BR>> imgShSc->SetScale(256/13000);<BR>><BR>> /// $$ The input image pixel range is from 0 to 13000./<BR>><BR>> /// $$ I wanted to convert the range from (0-13000)/<BR>><BR>> /// $$ to (0-255)./<BR>><BR>> <BR>><BR>> //****************************************************<BR>><BR>> // ***** Converting to Unsigned Char for JPEG writer *<BR>><BR>> //****************************************************<BR>><BR>> *vtkImageCast *imgCastIn = vtkImageCast::New();*<BR>><BR>> imgCastIn->SetInput(imgShSc ->
GetOutput());<BR>><BR>> imgCastIn->SetOutputScalarTypeToUnsignedChar(); <BR>><BR>> <BR>><BR>> //****************************************************<BR>><BR>> *vtkJPEGWriter *jpegWrIn = vtkJPEGWriter::New();*<BR>><BR>> jpegWrIn->SetInput(imgCastIn -> GetOutput());<BR>><BR>> jpegWrIn->SetFileName("Input10.jpg");<BR>><BR>> jpegWrIn->Write();<BR>><BR>> //****************************************************<BR>><BR>> <BR>><BR>> <BR>><BR>> Thank you,<BR>><BR>> <BR>><BR>> Ravi.<BR>><BR>> ------------------------------------------------------------------------<BR>> Yahoo! Music Unlimited - Access over 1 million songs. Try it free. <BR>> <HTTP: evt="36035/*http://music.yahoo.com/unlimited/" us.rd.yahoo.com *http:
pa.yahoo.com><BR>><BR>><BR>>------------------------------------------------------------------------<BR>><BR>>_______________________________________________<BR>>This is the private VTK discussion list. <BR>>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<BR>>Follow this link to subscribe/unsubscribe:<BR>>http://www.vtk.org/mailman/listinfo/vtkusers<BR>> <BR>><BR><BR>-- <BR>Bruno da Silva de Oliveira<BR>bruno@esss.com.br<BR>ESSS - Engineering Simulation and Scientific Software<BR>http://www.esss.com.br<BR><BR>_______________________________________________<BR>This is the private VTK discussion list. <BR>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<BR>Follow this link to subscribe/unsubscribe:<BR>http://www.vtk.org/mailman/listinfo/vtkusers<BR></BLOCKQUOTE><p>
                <hr size=1> <a href="http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yahoo.com/unlimited/">Yahoo! Music Unlimited - Access over 1 million songs. Try it free.</a>