[vtkusers] Problem with using vtkJPEGWriter

Bruno da Silva de Oliveira bruno at esss.com.br
Tue Oct 25 16:11:43 EDT 2005


Doesn't seem a problem with vtkJPEGWriter at all then... it seems the 
image is not being constructed correctly. You could try to save each 
step of your pipeline to isolate the problem (right after reading it 
from disk, for instance).

HTH,

Ravi Samala wrote:

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

-- 
Bruno da Silva de Oliveira
bruno at esss.com.br
ESSS - Engineering Simulation and Scientific Software
http://www.esss.com.br




More information about the vtkusers mailing list