[vtkusers] vtk GetTuple
David E DeMarle
dave.demarle at kitware.com
Wed Feb 8 07:52:01 EST 2012
Please keep the discussion on the mailing list so everyone can
contribute and benefit.
One of the three "->"'s after v8->GetOutput() is pointing to NULL
because the data isn't what you think it is. Find out which one.
David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909
On Wed, Feb 8, 2012 at 3:08 AM, cc cc <cctsinghua at gmail.com> wrote:
> Hello David,
>
> I just write like this:
>
> vtkVolume16Reader *v8 = vtkVolume16Reader::New();
> v8->SetDataDimensions(200,200);
> v8->GetOutput()->SetOrigin(0.0,0.0,0.0);
> v8->SetDataByteOrderToLittleEndian();
> v8->SetFilePrefix("/home/cc/Program/Mesh_generation/CCDATA2/MyData");
> v8->SetImageRange(1,200);
> v8->SetDataSpacing(3.2,3.2,1.5);
> v8->Update();
>
> vtkIdTypeArray *array =
> vtkIdTypeArray::SafeDownCast(v8->GetOutput()->GetPointData()->GetArray(1));
> array->GetValue(1);
>
> It turns out "segmentation fault". Where am I wrong? Thanks.
>
> Cheng
>
>
> 2012/2/7 David E DeMarle <dave.demarle at kitware.com>
>>
>> Work with the individual arrays in the field data.
>>
>> Use vtkFieldData::GetNumberOfArrays() and vtkFieldData::GetArray(N) or
>> GetAbstractArray(N) and iterate.
>> Then you can use the GetValue signatures to access the data without
>> type conversion and possible loss of precision.
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 21 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-881-4909
>>
>>
>>
>> On Mon, Feb 6, 2012 at 10:52 PM, cc cc <cctsinghua at gmail.com> wrote:
>> > Hello all,
>> >
>> > I have got a question about GetTuple() function, warnings always come
>> > out at
>> > the command window like this:
>> > "Generic Warning: In
>> > /home/cc/Program/VTK/VTK/Filtering/vtkFieldData.cxx,
>> > line 920
>> > vtkFieldData::GetTuple was deprecated for VTK 5.2 and will be removed in
>> > a
>> > future version."
>> > How can I get rid of it? Or what other function can I use to replace
>> > GetTuple()?
>> > "VTK_LEGACY_SILENT:BOOL=ON" in CMakeCache.txt doesn't work.
>> > I am new to VTK, say hello to all ^ ^.
>> >
>> > Cheng
>> >
>> > _______________________________________________
>> > 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