[vtkusers] vtkDICOMImageReader + Java

Lars Matthäus lars.matthaeus at web.de
Tue Jul 18 05:31:17 EDT 2006


For reading all DICOMs in a directory to get a 3D image use the
following method:

    public static vtkImageData getImageDataFromDICOM(String dir) {
        vtkDICOMImageReader dicomReader = new vtkDICOMImageReader();
        dicomReader.SetDirectoryName(dir);  //only recognized thing!!!
        vtkImageData fullImage = dicomReader.GetOutput();
        return fullImage;
    }

It only works if no other files apart from the DICOM set are in the
directory. As far as my experience shows, vtkDICOMImageReader is blind
to most methods in JAVA (like SetDataExtent, SetFilePattern,
SetDataOrigin, SetDataSpacing) which work for e.g. vtkJEPGReader; only
SetDirectoryName works. Comments anyone?

If you are interested in only one DICOM image (2D), use
dicomReader.SetFileName(String filename) instead of
dicomReader.SetDirectoryName(). Note that filename includes also the
directory with forward slashes ('/').

HTH
Lars

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060718/23767631/attachment.pgp>


More information about the vtkusers mailing list