[vtkusers] vtk 5.6.1 on a mac wrapped in Java

Mark Roden mmroden at gmail.com
Thu Dec 2 13:49:19 EST 2010


Maybe the problem is the build method I'm using for the libraries.

I'm building both gdcm and vtk using Unix makefiles on the mac, since
the xcode stuff isn't working.

How can I make sure that I'm building release versions on both
machines?  There's a suggestion here:
http://comments.gmane.org/gmane.comp.lib.mitk.user/1052

that this bug could be due to compilation problems.

Specifically, I'd like for 64 bit release versions to be made.  On
XCode, that's a dropdown selection, but typing 'make release' results
in 'don't know how to build release, stop', and I'm not sure what
'make all' is doing.

Thanks,
Mark

On Thu, Dec 2, 2010 at 7:00 AM, Mark Roden <mmroden at gmail.com> wrote:
> The java code works fine on windows, it's the same code, shared via
> git on the different machines
>
> I'm not trying to inherit.  vtkImageChangeInformation is exposed by
> the vtk java wrapping, but the vtlImageData I'm passing in isn't
> working.
>
> This code works in java on windows.  It doesn't on mac.  I use the
> same libraries underneath, or at least, the same versions of gdcm and
> vtk are built and used.
>
> On Thu, Dec 2, 2010 at 6:53 AM, Sebastien Jourdain
> <sebastien.jourdain at kitware.com> wrote:
>> I was talking about your Java code that was using VTK, not VTK itself.
>>
>> Moreover, I think that you can not inherit from VTK classes in Java...
>>
>> Seb
>>
>> On Thu, Dec 2, 2010 at 9:17 AM, Mark Roden <mmroden at gmail.com> wrote:
>>> Hi Sebastien,
>>>
>>> I can't use the windows binary on the mac-- the vtk underpinnings are
>>> still C++, which means that it's compiled into a dll on windows, which
>>> means (as far as I know, and as my experiments confirm), it doesn't
>>> work on a mac.  I have to recompile vtk for the mac directly.  The
>>> java wrappings (the jar) should be identical, though.  Just to be
>>> safe, I'm using the mac-generated jars now.
>>>
>>> I am sure that the filenames have no spaces or special strings.  If
>>> you look at the line
>>>
>>>     String theString2 = sortedFT.get(i)
>>>
>>> I can stop there with the debugger and see the contents of the string,
>>> and it's clean.
>>>
>>> For what it's worth, Fred Fred asked about this error message a year
>>> ago, and he got no response:
>>> http://public.kitware.com/pipermail/vtkusers/2009-October/102935.html
>>> I don't know if he was in the same situation as me, though.
>>>
>>> Thanks,
>>> Mark
>>>
>>> On Thu, Dec 2, 2010 at 5:02 AM, Sebastien Jourdain
>>> <sebastien.jourdain at kitware.com> wrote:
>>>> Hi Mark,
>>>>
>>>> did you try your windows (Java) binary on your mac to see if you get
>>>> the same behavior ?
>>>> Are you sure that on your mac, the filename provided to the reader are
>>>> correct ? (no space or special string ?)
>>>>
>>>> Seb
>>>>
>>>> On Thu, Dec 2, 2010 at 12:01 AM, Mark Roden <mmroden at gmail.com> wrote:
>>>>> 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
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>>
>>>>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>
>>>>
>>>
>>
>



More information about the vtkusers mailing list