[vtkusers] Reduce size of .VTK file & Take too long time to load .VTK file

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue Aug 11 04:04:39 EDT 2009


On Tue, Aug 11, 2009 at 8:48 AM, Gururajan<gururajan.r at raster.in> wrote:
> Hi all,
>
> Sub -> need to reduce the size of the .VTK file.
>
> Actually my application process is. Am following the below mentioned type
> for reading dicom series files and to covert it into .vtk file , to view in
> 3D.
> But my .vtk file size is getting bigger after the following process this
> strucks my application. (Take long time to load the 3d file).
> Please guide me on this,
>
> --For Reading Dicom series and Wrting .Raw and .vtk files in the below
> process
> VTKDicomImageReader->vtkImageWriter->vtkVolume16Reader->vtkMarchingCubes->vtkPolyDataNormals->vtkPolyDataWriter
>
> --For view .Vtk file
> vtkPolyDataReader->vtkPolyData->vtkPolyDataMapper->vtkLODActor->vtkRenderWindow
>
> After reading dicom series, i created .raw (VtkImageWriter) file and then i
> will convert this raw file into .vtk format.
> using vtkPolyDataWriter to write .vtk files

I am answering from the gdcm-dev point of view. If you want to reduce
the size of the actual DICOM Series, you should use gdcmconv with a
compression such as JPEG 2000 or JPEG-LS. See gdcmconv documentation.
Since you have a vtkImageData loaded in memory, you could use
vtkGDCMImageWriter, you should turn the compression flag to the one
you want:

  vtkGDCMImageWriter::SetCompressionType( ct )

where ct can be of:

  enum CompressionTypes {
    NO_COMPRESSION = 0,   // raw (default)
    JPEG_COMPRESSION,     // JPEG
    JPEG2000_COMPRESSION, // J2K
    JPEGLS_COMPRESSION,   // JPEG-LS
    RLE_COMPRESSION       // RLE
  };

Ref:
http://gdcm.sourceforge.net/html/classvtkGDCMImageWriter.html

2cts
-- 
Mathieu



More information about the vtkusers mailing list