[vtkusers] Sphere with scalar values

David Doria daviddoria+vtk at gmail.com
Sat Jan 16 15:14:49 EST 2010


On Sat, Jan 16, 2010 at 1:33 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Sat, Jan 16, 2010 at 12:04 PM, KS Jothybasu <jothybasu at gmail.com> wrote:
>> Hi David,
>>
>> What you said is true, finding  the points  inside the sphere and setting
>> its scalar value.
>>
>> But, my problem is that, I need to move the sphere to multiple positions and
>> do some calculations with the sphere scalar values and the scalar values of
>> the vtkimagedata. If I can set the scalars to the sphere directly,I don't
>> need to recompute those scalars for each and every position of sphere.
>>
>> Did you get it? I can give you some more explanation if you wish.
>>
>> Shall I create the sphere from scratch, as a vtkVolume/vtkPolydata, if so ,
>> any examples...
>>
>>
>> Thanks
>>
>> Jothy
>>
>> On Sat, Jan 16, 2010 at 4:52 PM, David Doria <daviddoria+vtk at gmail.com>
>> wrote:
>>>
>>> On Sat, Jan 16, 2010 at 11:49 AM, KS Jothybasu <jothybasu at gmail.com>
>>> wrote:
>>> > vtkPSphereSource means "sphere source that supports pieces " as the vtk
>>> > doc
>>> > says.
>>> >
>>> > I don't understand what supporting pieces means.
>>> >
>>> > Regarding my sphere object.
>>> >
>>> > I need to create a sphere object, let's say 5 cm radius. Indise that I
>>> > want
>>> > to set scalar values as we set for vtkImageData with
>>> > SetScalarComponentFromFloat(x,y,z,0,HU).
>>> >
>>> > Thanks
>>> >
>>> > Jothy
>>> >
>>> >
>>> >
>>> > On Sat, Jan 16, 2010 at 4:37 PM, David Doria <daviddoria+vtk at gmail.com>
>>> > wrote:
>>> >>
>>> >> On Sat, Jan 16, 2010 at 10:30 AM, KS Jothybasu <jothybasu at gmail.com>
>>> >> wrote:
>>> >> > Hi,
>>> >> >
>>> >> > I am trying to create a sphere object comprising of voxels and
>>> >> > setting
>>> >> > the
>>> >> > scalar values. But I am yet a find a proper method to do this.
>>> >> >
>>> >> > Could any of you please give me a hint?
>>> >> >
>>> >> > Should I create sphere object with polydata?
>>> >> >
>>> >> > What's the difference between vtkSphereSource and vtkPSphereSource
>>> >> >
>>> >> > Thanks
>>> >> >
>>> >> > Jothy
>>> >> >
>>> >>
>>> >> If I understand correctly, vtkP* means it is a parallel version of the
>>> >> vtk* filter. I don't think it has any relevance to your question.
>>> >>
>>> >> I guess I don't follow what you mean by "a sphere object comprising of
>>> >> voxels". Can you elaborate or give an example?
>>> >>
>>> >> Thanks,
>>> >>
>>> >> David
>>> >> _______________________________________________
>>> >> 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
>>> >
>>> >
>>>
>>> Please keep the discussion on the mailing list.
>>>
>>> I agree that "supporting pieces" is not very clear. What I believe it
>>> means is that the memory that comprises the object is split into
>>> "pieces" which reside on multiple computers (hence, the parallel
>>> version of the object).
>>>
>>> Why don't you just create an ImageData and for each point in the
>>> ImageData test if it is inside your sphere. If it is, then set it's
>>> scalar value.
>>>
>>> Will that work?
>>>
>>> Thanks,
>>>
>>> David
>
> Again, please keep the discussion on the mailing list.
>
> Can't you just apply the transformation that you would have applied to
> the sphere to the ImageData instead to position the scalars in your
> scene?
>
> Thanks,
>
> David
>

Ok, so I take back what I said. An ImageData is always axis-aligned
with the global coordinate system. Same with a RectilinearGrid. Looks
like you'd need to use a StructuredGrid and specify the points as they
would be implicitly in an ImageData. THEN you can apply a general
transform to them.

Let me know if that works.

Thanks,

David



More information about the vtkusers mailing list