[vtkusers] vtk 5.6.1 on a mac wrapped in Java

Mark Roden mmroden at gmail.com
Thu Dec 2 00:01:27 EST 2010


Hi all,

So I managed to get vtk 5.6.1 to work on a mac with java wrappings on
(10.6.5) and with gdcm.

The following code is producing errors that I don't see on windows:

               IPPSorter sorter = new IPPSorter();
                sorter.SetComputeZSpacing(true);
                sorter.SetZSpacingTolerance(0.000001);
                Boolean sorted = sorter.Sort(theSeriesFiles);
                //sorter.Sort(ft);

                //have to make a vtk string array
                FilenamesType sortedFT = sorter.GetFilenames();
                long theSize = sortedFT.size();
                vtkStringArray sa = new vtkStringArray();
                for (int j = 0; j < theSize; j++) {
                    String theString2 = sortedFT.get(j);
                    sa.InsertNextValue(sortedFT.get(j));
                }
                gdcmReader.SetFileNames(sa);

                gdcmReader.Update();

                imageData = gdcmReader.GetOutput();

                //make sure that we're getting spacing and orientation info
                double[] spacing = imageData.GetSpacing();
                spacing[2] = sorter.GetZSpacing();
                imageData.SetSpacing(spacing);
                double[] origin = imageData.GetOrigin();
                double[] bounds = imageData.GetBounds();
                double[] extraOrigin = {0,0,0};//because vtk will only
flip about 0,0,0

                vtkImageChangeInformation imageSpacingChange = new
vtkImageChangeInformation();
                imageSpacingChange.SetInput(imageData);
                imageSpacingChange.SetOutputSpacing(spacing[0],
spacing[1], spacing[2]);
                imageSpacingChange.SetOutputOrigin(extraOrigin);
                imageSpacingChange.Update();

Once the last line is hit, the following error is reported in netbeans:

ERROR: In /Users/mmroden/Documents/src/vtk-5.6.1/VTK-5.6.1/Filtering/vtkDemandDrivenPipeline.cxx,
line 802
vtkStreamingDemandDrivenPipeline (0x135884c10): Input for connection
index 0 on input port index 0 for algorithm
vtkImageChangeInformation(0x1358853c0) is NULL, but a vtkImageData is
required.

This code works perfectly well in Windows, and the spacing, origin,
and bounds arrays all match the values in windows when loading the
same series there.  So, I know that the gdcm side of things is
working, at least to the point that those arrays are being reported
correctly.

Because the pipeline is breaking there, nothing else is working.  What
can I do to fix it?

Thanks,
Mark



More information about the vtkusers mailing list