Attached is a XML that you can load as a plugin using the Tools |
Plugin Manager. This will add a new "Import CSV As Volume" source
under the "Sources" menu. On creating this new source, you'll be able
to select the CSV file and specify the relevant meta-data as
properties. I've setup the defaults to match the file you sent. The
Python code assumes that the CSV file has data in the same order as
VTK expects i.e. X varying first, then Y and then Z. Hence the image
dimensions are flipped.
Also, this is designed to work only for a single process mode, it'll
need some work if it's to work in parallel too.
Utkarsh
On Fri, Apr 10, 2015 at 3:35 PM, Utkarsh Ayachit
<[email protected]> wrote:
> You cannot volume render data coming in from a CSV file. If you want
> to sned me a sample CSV, I can send you a Programmable Source code
> than will produce a volume renderable dataset.
>
>
> On Fri, Apr 10, 2015 at 12:21 PM, yufei shen <[email protected]> wrote:
>> Good afternoon:
>>
>> I am just beginning to use Paraview, and I'm using it to plot a 3D current
>> scalar field, with x,y,z being the coordinates of a point in space, while
>> the forth column value represents the intensity of current passing through
>> that point. My input file is .csv.
>>
>> After I have tetrahedralized my points, the figure show up in the plotting
>> window perfectly with surface, point or any other representations except
>> VOLUME. I can adjust color together with alpha values, however, as soon as I
>> switch to 'volume', everything just disappears. I've also tried the same
>> thing on all platforms (Mac, linux, Windows), but the problem is not solved.
>>
>> I wonder what's causing this problem? Should I used a different input file
>> format other than .csv? It seems what I am doing is really simple compared
>> with paraview's capability. I have also checked the archives but could not
>> find any solution to this...
>>
>> I really appreciate your help!
>>
>> Best Regards
>> Yufei
>>
>> _______________________________________________
>> 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 ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/paraview
>>
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy name="OpenCSVAsVolume" class="vtkPythonProgrammableFilter" label="Import CSV As Volume">
<Documentation >
Import a CSV as a 3D volume.
</Documentation>
<StringVectorProperty
name="FileName"
label="FileName"
initial_string="FileName"
command="SetParameter"
animateable="1"
default_values="sample.csv"
number_of_elements="1">
<FileListDomain name="files" />
<Documentation>Select the CSV file to open.</Documentation>
</StringVectorProperty>
<IntVectorProperty
name="Dimensions"
label="Dimensions"
initial_string="Dimensions"
command="SetParameter"
animateable="1"
default_values="100 100 18"
number_of_elements="3">
<Documentation>
Note that the data in the CSV file must be order expected by VTK i.e. X changes first,
then Y and finally Z.
</Documentation>
</IntVectorProperty>
<IntVectorProperty
name="Spacing"
label="Spacing"
initial_string="Spacing"
command="SetParameter"
animateable="1"
default_values="1 1 1"
number_of_elements="3">
<Documentation></Documentation>
</IntVectorProperty>
<StringVectorProperty
name="ActiveScalars"
initial_string="ActiveScalars"
command="SetParameter"
animateable="1"
default_values="current"
number_of_elements="1">
<Documentation>
Set the name of the array to set as the active scalars.
</Documentation>
</StringVectorProperty>
<!-- Output data type: "vtkImageData" -->
<IntVectorProperty command="SetOutputDataSetType"
default_values="6"
name="OutputDataSetType"
number_of_elements="1"
panel_visibility="never">
<Documentation>The value of this property determines the dataset type
for the output of the programmable filter.</Documentation>
</IntVectorProperty>
<StringVectorProperty
name="Script"
command="SetScript"
number_of_elements="1"
default_values="import numpy as np

assert FileName
data = np.genfromtxt(FileName,
 dtype=None,
 names=True,
 delimiter=',',
 autostrip=True)

dims = Dimensions

assert data.shape[0] == dims[0] * dims[1] * dims[2], "dimensions mismatch"

output.SetExtent(0, dims[0]-1, 0, dims[1]-1, 0, dims[2] - 1)

for name in data.dtype.names:
 array = data[name]
 output.PointData.append(array, name)

assert ActiveScalars
output.PointData.SetActiveScalars(ActiveScalars)
"
panel_visibility="advanced">
<Hints>
<Widget type="multi_line" syntax="python" />
</Hints>
<Documentation>This property contains the text of a python program that
the programmable source runs.</Documentation>
</StringVectorProperty>
<StringVectorProperty
name="InformationScript"
label="RequestInformation Script"
command="SetInformationScript"
number_of_elements="1"
default_values="executive = self.GetExecutive()
outInfo = executive.GetOutputInformation(0)

assert len(Dimensions) == 3
outInfo.Set(executive.WHOLE_EXTENT(), 0, Dimensions[0]-1,
 0, Dimensions[1]-1,
 0, Dimensions[2]-1)

assert len(Spacing) == 3
outInfo.Set(vtk.vtkDataObject.SPACING(), Spacing[0], Spacing[1], Spacing[2])
"
panel_visibility="advanced">
<Hints>
<Widget type="multi_line" syntax="python" />
</Hints>
<Documentation>This property is a python script that is executed during
the RequestInformation pipeline pass. Use this to provide information
such as WHOLE_EXTENT to the pipeline downstream.</Documentation>
</StringVectorProperty>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
_______________________________________________
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 ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview