Re: [Paraview] CSV Files and Volumetric Data

2018-04-04 Thread Moreland, Kenneth
In order for this to work, your CSV file has to contain columns for both the 
spatial position AND the vectors you want to visualize. It looks like the csv 
file you are creating is actually only writing out the vector field. To get 
this to work, your gen_sally function should fill a second array that simply 
contains the x, y, and z variables on the inner loop. Then your create_csv 
function should write a csv file with 6 columns. Three of them are for the 
position coordinate I just described, and the other 3 are the vector that you 
are currently writing.

-Ken

From: ParaView [mailto:paraview-boun...@public.kitware.com] On Behalf Of 
GILLILAND G. (929919)
Sent: Wednesday, April 4, 2018 3:16 PM
To: paraview@public.kitware.com
Subject: [EXTERNAL] [Paraview] CSV Files and Volumetric Data

Hi there,

I have assignment where data is produced in C, and i have to export it to a 
relevant file format that works with a visualisation software of my choice.

I've chosen Paraview, because i know that CSV files work with this software.

Rather than table to points, i want to be able to convert the points to a 
volumetric dataset... So i can have greater control over colour mapping. But i 
was told that the code that generates the dataset is missing some data, or i 
may have missed something in the way i export the file.

I've included the code below; i would love some help with this. I'm only decent 
with coding in Java and my lecturer has really given the class a lot of support.

Cheers

#include
#include
#include
#include

void gen_sally( int xs, int ys, int zs, int time, float *sally )
/*
 *  Gen_Sally creates a vector field of dimension [xs,ys,zs,3] from
 *  a proceedural function. By passing in different time arguements,
 *  a slightly different and rotating field is created.
 *
 *  The magnitude of the vector field is highest at some funnel shape
 *  and values range from 0.0 to around 0.4 (I think).
 *
 *  I just wrote these comments, 8 years after I wrote the function.
 *
 *  Developed by Sally of Sally University
 *
 */
{
  float x, y, z;
  int ix, iy, iz;
  float r, xc, yc, scale, temp, z0;
  float r2 = 8;
  float SMALL = 0.001;
  float xdelta = 1.0 / (xs-1.0);
  float ydelta = 1.0 / (ys-1.0);
  float zdelta = 1.0 / (zs-1.0);

  for( iz = 0; iz < zs; iz++ )
  {
z = iz * zdelta;// map z to 0->1
xc = 0.5 + 0.1*sin(0.04*time+10.0*z);   // For each z-slice, determine the 
spiral circle.
yc = 0.5 + 0.1*cos(0.03*time+3.0*z);//(xc,yc) determine the center of 
the circle.
r = 0.1 + 0.4 * z*z + 0.1 * z * sin(8.0*z); //  The radius also changes at each 
z-slice.
r2 = 0.2 + 0.1*z;   //r is the center radius, r2 is 
for damping
for( iy = 0; iy < ys; iy++ )
{
y = iy * ydelta;
for( ix = 0; ix < xs; ix++ )
{
x = ix * xdelta;
temp = sqrt( (y-yc)*(y-yc) + (x-xc)*(x-xc) );
scale = fabs( r - temp );
/*
 *  I do not like this next line. It produces a discontinuity
 *  in the magnitude. Fix it later.
 *
 */
   if ( scale > r2 )
  scale = 0.8 - scale;
   else
  scale = 1.0;
z0 = 0.1 * (0.1 - temp*z );
   if ( z0 < 0.0 )  z0 = 0.0;
   temp = sqrt( temp*temp + z0*z0 );
scale = (r + r2 - temp) * scale / (temp + SMALL);
scale = scale / (1+z);
   *sally++ = scale * (y-yc) + 0.1*(x-xc);
   *sally++ = scale * -(x-xc) + 0.1*(y-yc);
   *sally++ = scale * z0;
}
}
  }
}


void create_csv(char* filename,float *sally, int size){
printf("1");
printf("\n Creating %s.csv file",filename);
FILE *fp;
fp=fopen(filename,"w");
fprintf(fp,"X,Y,Z\n");
int i;
int counter = 0;
for(i = 0; i< size; i++){
if(sally[i] == 0){
fprintf(fp,"0");
}
else{
fprintf(fp,"%f",sally[i]);
}
counter++;
if(counter == 3){
fprintf(fp, "\n");
counter = 0;
}
else{
fprintf(fp,",");
}
}
fclose(fp);
printf("\n %sfile created",filename);
}
int main(int argc, char *argv[]){
printf("1\n");
//read from args
int xs;
int ys;
int zs;
int time;
sscanf(argv[1],"%d",);
sscanf(argv[2],"%d",);
sscanf(argv[3],"%d",);
sscanf(argv[4],"%d",);


int arraySize = xs*ys*zs*3;
//allocate memeory for array. This is done so that stack memory doesn't run 
out.'
float* sally;
sally = (float*)malloc((arraySize) * sizeof(float));

//runs the code. One of the args is a pointer so no return type is needed.
gen_sally(xs,ys,zs,time,sally);
//create varibles for file generation
char filename[20] = "results.csv";
create_csv(filename, sally, arraySize);

free(sally);
return 0;
}

___
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:
https://public.kitware.com/mailman/listinfo/paraview


[Paraview] CSV Files and Volumetric Data

2018-04-04 Thread GILLILAND G. (929919)
Hi there,

I have assignment where data is produced in C, and i have to export it to a 
relevant file format that works with a visualisation software of my choice.

I've chosen Paraview, because i know that CSV files work with this software.

Rather than table to points, i want to be able to convert the points to a 
volumetric dataset... So i can have greater control over colour mapping. But i 
was told that the code that generates the dataset is missing some data, or i 
may have missed something in the way i export the file.

I've included the code below; i would love some help with this. I'm only decent 
with coding in Java and my lecturer has really given the class a lot of support.

Cheers

#include
#include
#include
#include

void gen_sally( int xs, int ys, int zs, int time, float *sally )
/*
 *  Gen_Sally creates a vector field of dimension [xs,ys,zs,3] from
 *  a proceedural function. By passing in different time arguements,
 *  a slightly different and rotating field is created.
 *
 *  The magnitude of the vector field is highest at some funnel shape
 *  and values range from 0.0 to around 0.4 (I think).
 *
 *  I just wrote these comments, 8 years after I wrote the function.
 *
 *  Developed by Sally of Sally University
 *
 */
{
  float x, y, z;
  int ix, iy, iz;
  float r, xc, yc, scale, temp, z0;
  float r2 = 8;
  float SMALL = 0.001;
  float xdelta = 1.0 / (xs-1.0);
  float ydelta = 1.0 / (ys-1.0);
  float zdelta = 1.0 / (zs-1.0);

  for( iz = 0; iz < zs; iz++ )
  {
z = iz * zdelta;// map z to 0->1
xc = 0.5 + 0.1*sin(0.04*time+10.0*z);   // For each z-slice, determine the 
spiral circle.
yc = 0.5 + 0.1*cos(0.03*time+3.0*z);//(xc,yc) determine the center of 
the circle.
r = 0.1 + 0.4 * z*z + 0.1 * z * sin(8.0*z); //  The radius also changes at each 
z-slice.
r2 = 0.2 + 0.1*z;   //r is the center radius, r2 is 
for damping
for( iy = 0; iy < ys; iy++ )
{
y = iy * ydelta;
for( ix = 0; ix < xs; ix++ )
{
x = ix * xdelta;
temp = sqrt( (y-yc)*(y-yc) + (x-xc)*(x-xc) );
scale = fabs( r - temp );
/*
 *  I do not like this next line. It produces a discontinuity
 *  in the magnitude. Fix it later.
 *
 */
   if ( scale > r2 )
  scale = 0.8 - scale;
   else
  scale = 1.0;
z0 = 0.1 * (0.1 - temp*z );
   if ( z0 < 0.0 )  z0 = 0.0;
   temp = sqrt( temp*temp + z0*z0 );
scale = (r + r2 - temp) * scale / (temp + SMALL);
scale = scale / (1+z);
   *sally++ = scale * (y-yc) + 0.1*(x-xc);
   *sally++ = scale * -(x-xc) + 0.1*(y-yc);
   *sally++ = scale * z0;
}
}
  }
}


void create_csv(char* filename,float *sally, int size){
printf("1");
printf("\n Creating %s.csv file",filename);
FILE *fp;
fp=fopen(filename,"w");
fprintf(fp,"X,Y,Z\n");
int i;
int counter = 0;
for(i = 0; i< size; i++){
if(sally[i] == 0){
fprintf(fp,"0");
}
else{
fprintf(fp,"%f",sally[i]);
}
counter++;
if(counter == 3){
fprintf(fp, "\n");
counter = 0;
}
else{
fprintf(fp,",");
}
}
fclose(fp);
printf("\n %sfile created",filename);
}
int main(int argc, char *argv[]){
printf("1\n");
//read from args
int xs;
int ys;
int zs;
int time;
sscanf(argv[1],"%d",);
sscanf(argv[2],"%d",);
sscanf(argv[3],"%d",);
sscanf(argv[4],"%d",);


int arraySize = xs*ys*zs*3;
//allocate memeory for array. This is done so that stack memory doesn't run 
out.'
float* sally;
sally = (float*)malloc((arraySize) * sizeof(float));

//runs the code. One of the args is a pointer so no return type is needed.
gen_sally(xs,ys,zs,time,sally);
//create varibles for file generation
char filename[20] = "results.csv";
create_csv(filename, sally, arraySize);

free(sally);
return 0;
}

___
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:
https://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] AppendAttributes issue

2018-04-04 Thread Sebastien Jourdain
This has to do with the origin of our vtkImageData which is not using the
same as your elevation data.

(top, left) vs (bottom, left)

On Wed, Apr 4, 2018 at 11:18 AM, Andy Bauer  wrote:

> Any chance you could share the datasets and maybe a state file so that I
> could try to reproduce your issue?
>
> I can't think of anything off the top of my head that would case this.
>
> On Wed, Apr 4, 2018 at 1:13 PM, Christian Adrián Álvarez Báez <
> christian.alvarez...@gmail.com> wrote:
>
>> Hello,
>>
>> I have an UCD (ASCII) and a DEM, I would like to color the UCD by
>> elevation (since the UCD alone just can be color by Material ID, which has
>> nothing to do with elevation). For this I got a DEM with the exactly same
>> array than the UCD. I apply AppendAtributes to both and I can color now
>> with elevation. The problem is that the elevation color is upside down. I
>> attached a picture to make sense.
>>
>> Thank you very much for your attention. I hope you could help me.
>> Christian
>>
>> ___
>> 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:
>> https://public.kitware.com/mailman/listinfo/paraview
>>
>>
>
> ___
> 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:
> https://public.kitware.com/mailman/listinfo/paraview
>
>
___
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:
https://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] AppendAttributes issue

2018-04-04 Thread Andy Bauer
Any chance you could share the datasets and maybe a state file so that I
could try to reproduce your issue?

I can't think of anything off the top of my head that would case this.

On Wed, Apr 4, 2018 at 1:13 PM, Christian Adrián Álvarez Báez <
christian.alvarez...@gmail.com> wrote:

> Hello,
>
> I have an UCD (ASCII) and a DEM, I would like to color the UCD by
> elevation (since the UCD alone just can be color by Material ID, which has
> nothing to do with elevation). For this I got a DEM with the exactly same
> array than the UCD. I apply AppendAtributes to both and I can color now
> with elevation. The problem is that the elevation color is upside down. I
> attached a picture to make sense.
>
> Thank you very much for your attention. I hope you could help me.
> Christian
>
> ___
> 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:
> https://public.kitware.com/mailman/listinfo/paraview
>
>
___
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:
https://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] Fwd: Missing *Hierarchy files in Plugins

2018-04-04 Thread Alexander Lindsay
So I think I determined that the problem with the missing Hierarchy files
was attributable to trying to use an external VTK installation...

But I noted something very peculiar when trying to build paraview using the
vtk submodule. If I just ran:

cmake ..
make -j32

then I would get a lot of undefined references. If I ran `nm` on a library
like `libvtkCommonCore-9.0.so.1`, all the symbols were local, e.g. `t`, so
the undefined references are not a surprise. Now if I ran `cmake` and
`make` a second time (without touching anything), then the build would go
to completion. `nm` on the same library now reveals all the symbols to be
global.

I got the same behavior when just building a stand-alone vtk.

Anyone have a hypothesis for explaining this odd behavior? This is when
building on Linux (Ubuntu 16.04). If I build on OS X, then a single `cmake`
and `make` successfully build.

Alex


On Fri, Mar 30, 2018 at 12:27 PM, Alexander Lindsay <
alexlindsay...@gmail.com> wrote:

> I don't care about that plugin, so happy to disable.
>
> But if anyone does want to debug, the only option I enabled was
> `PARAVIEW_USE_MPI`
>
> On Fri, Mar 30, 2018 at 12:15 PM, Shawn Waldon 
> wrote:
>
>> Hi Alexander,
>>
>> There is an easy workaround as long as you don't care about the
>> AnalyzeNIfTIIO plugin: just disable the plugin (set the CMake option
>> PARAVIEW_BUILD_PLUGIN_AnalyzeNIfTIIO to OFF).
>>
>> If you do care about the file formats that that plugin enables, then
>> someone will need to do some more debugging on this.  Can you provide more
>> details about which CMake options you are enabling?
>>
>> HTH,
>> Shawn
>>
>> [1]: https://gitlab.kitware.com/paraview/paraview/issues
>>
>> On Fri, Mar 30, 2018 at 1:59 PM, Alexander Lindsay <
>> alexlindsay...@gmail.com> wrote:
>>
>>> Hi, when building paraview from source with either `make` or `ninja` I
>>> run into the following type of error:
>>>
>>> ninja: error: '../Plugins/AnalyzeNIfTIReader
>>> Writer/AnalyzeNIfTIIOHierarchy', needed by
>>> 'Plugins/AnalyzeNIfTIReaderWriter/vtkAnalyzeReaderClientServer.cxx',
>>> missing and no known rule to make it
>>>
>>> Sure enough this file doesn't exist. I am currently on the master
>>> branch, building on Ubuntu 16.04. I'm guessing/hoping there's an easy fix
>>> to this...?
>>>
>>> Alex
>>>
>>>
>>>
>>> ___
>>> 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:
>>> https://public.kitware.com/mailman/listinfo/paraview
>>>
>>>
>>
>
___
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:
https://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] Using ninja to build/install ParaView

2018-04-04 Thread David E DeMarle
I agree with Mathieu, you don't need a fork of Ninja to build/install
paraview.

Chris you might be interested in the paraview superbuild project -
https://gitlab.kitware.com/paraview/paraview-superbuild

We use that to 1) make our redistributable binaries and 2) to deploy
paraview on clusters and supercomputers. Two salient features in it are
that 1) it can either build and package or or simply use system versions of
paraview's dependencies, and 2) that it fixes up the library paths when
needed.

hth




David E DeMarle
Kitware, Inc.
Principal Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Wed, Apr 4, 2018 at 1:43 AM, Mathieu Westphal <
mathieu.westp...@kitware.com> wrote:

> Hi Chris,
>
> AFAIK, ParaView does not require the kitware fork of Ninja.
> I just build and installed with Ninja 1.8.2, it works well and the
> installed binaries links correctly.
>
> Could you check with a standard Ninja ? and could you precise your
> configuration options ?
>
> Best,
>
> Mathieu Westphal
>
> On Tue, Apr 3, 2018 at 10:50 PM, Chris Coutinho 
> wrote:
>
>> Hello,
>>
>>
>>
>> I’m using the Kitware fork of ninja, which builds the latest release
>> candidate of ParaView just fine, but when I install it to the specified
>> install location (via ninja install), all of the executables are suddenly
>> unable to find other linked libraries. In the build directory everything
>> works, but the locations of various libraries (ie MPI) don’t carry over,
>> and calling ParaView fails due to not being able to find those libraries.
>>
>>
>>
>> Running ‘ldd’ on the executable shows that that all the libraries aren’t
>> able to be found.
>>
>>
>>
>> I’m curious if this is just a fact of Ninja as primarily a dev tool, or
>> maybe I’m just not passing it the proper flags?
>>
>>
>>
>>
>>
>> Met vriendlijke groet,
>>
>> REDstack BV
>>
>>
>>
>> *Chris Coutinho*
>>
>> Onderzoeker/Data Analist
>>
>>
>>
>> tel: +31 (0)6 –  5785
>>
>> post: Postbox 199, 8600 AD Sneek
>>
>> bezoekadres: Pieter Zeemanstraat 6, 8606 JR Sneek
>>
>> email: c.couti...@redstack.nl
>>
>> www: www.redstack.nl
>>
>>
>>
>> [image: REDstack_logo2]
>>
>>
>>
>> ___
>> 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:
>> https://public.kitware.com/mailman/listinfo/paraview
>>
>>
>
> ___
> 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:
> https://public.kitware.com/mailman/listinfo/paraview
>
>
___
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:
https://public.kitware.com/mailman/listinfo/paraview