|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Adding KeyPressEvent "r" in GUIDear vtkusers and developers, I am trying to implement the "reset view" action that occurs when typing "r" in the vtk window. I am using a GUI made with QT and I want this to happen after hitting a button. Is there some way I can manually invoke a keypressevent? Or this there some function that can do this resetting of the view? Thanks, John _______________________________________________ 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 |
|
|
Re: Adding KeyPressEvent "r" in GUIHi John,
If you have a vtkRenderer called "renderer" (that gets rendered in your vtkRenderWindow), call renderer->ResetCamera(); when pressing the button. Don't forget to render the scene again after that, else your renderwindow won't be updated. If you are using a QVTKWidget called "qvtkwid" call qvtkwid->GetRenderWindow()->Render(); Cheers, Dirk On 11/09/2009 07:17:40 PM, John Durkin wrote: > Dear vtkusers and developers, > > > I am trying to implement the "reset view" action that occurs when > typing "r" > in the vtk window. I am using a GUI made with QT and I want this to > happen > after hitting a button. Is there some way I can manually invoke a > keypressevent? Or this there some function that can do this > resetting > of > the view? > > Thanks, > > > John > ------quoted attachment------ > _______________________________________________ > 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 > _______________________________________________ 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 |
|
|
Re: duplicated vertex in marching cubes?Hi all! I am using vtkMarchingCubes to calculate a 3D mesh of a volume I have. Fist I initialize the filter with: vtkMarchingCubes* iso = vtkMarchingCubes::New(); iso->SetInput(object); iso->SetValue(0,1); // Surface #0, iso-value=1 iso->Update(); then I fill the vtkStructuredPoints. The problem I have is, as you can see in the pictures, when you have a close look to the trianbles (screen2) you can see duplicated triangles and vertex, and this is a huge problem for my application... I supposed vtkMarchingCubes should generate a single surface mesh... I don't know if that's the reason, but when I fill the vtkStructuredPoints I use scalars->InsertValue(cnt, 0) ; and scalars->InsertValue(cnt, 128) ; I took all these from an example, I still don't know what you have to set as values, either 1 or 128... in addition the result change with this number and I'm not sure why. What should I use as values? and also why I have this "double" triangles mesh? thanks! Jaime. Windows Live: Make it easier for your friends to see what you’re up to on Facebook. Keep your friends updated— even when you’re not signed in. Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. _______________________________________________ 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 |
|
|
Re: duplicated vertex in marching cubes?Please provide a small, complete example. MC should not generate
duplicate points or vertices. What is the datatype of your scalars? On Wed, Nov 11, 2009 at 10:20 AM, lucas Grijander <dev_crisalix@...> wrote: > > Hi all! > I am using vtkMarchingCubes to calculate a 3D mesh of a volume I have. Fist > I initialize the filter with: > vtkMarchingCubes* iso = vtkMarchingCubes::New(); > iso->SetInput(object); > iso->SetValue(0,1); // Surface #0, iso-value=1 > iso->Update(); > then I fill the vtkStructuredPoints. > The problem I have is, as you can see in the pictures, when you have a close > look to the trianbles (screen2) you can see duplicated triangles and vertex, > and this is a huge problem for my application... I supposed vtkMarchingCubes > should generate a single surface mesh... I don't know if that's the reason, > but when I fill the vtkStructuredPoints I use > scalars->InsertValue(cnt, 0) ; and scalars->InsertValue(cnt, 128) ; > I took all these from an example, I still don't know what you have to set as > values, either 1 or 128... in addition the result change with this number > and I'm not sure why. > What should I use as values? and also why I have this "double" triangles > mesh? > thanks! > Jaime. > ________________________________ > Windows Live: Make it easier for your friends to see what you’re up to on > Facebook. > ________________________________ > Keep your friends updated— even when you’re not signed in. > ________________________________ > Windows Live: Friends get your Flickr, Yelp, and Digg updates when they > e-mail you. > _______________________________________________ > 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 > > 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 |
|
|
Re: duplicated vertex in marching cubes?This is my code. Basically I have a mesh "geometry" and I project rays in order to fill the matrix of points. *********************************** vtkStructuredPoints *object = prepareVTKObjectForMarching(geom,40); //Iso-surface using marching cubes vtkMarchingCubes* iso = vtkMarchingCubes::New(); iso->SetInput(object); iso->SetValue(0,1); // Surface #0, iso-value=1 iso->Update(); then the function prepareVTKObjectForMarching vtkStructuredPoints* prepareVTKObjectForMarching(osg::Geometry *geometry, int steps, string name) { TBBox bbox = createBoundingBox(geometry); bbox.length[0] *= 1.2; bbox.length[1] *= 1.2; bbox.length[2] *= 1.2; float lengthStep = bbox.length[bbox.maxLAxis]/(float)steps; int dim[3]; dim[0] = steps; dim[1] = steps; dim[2] = steps; double ar[3]; ar[0] = lengthStep; ar[1] = lengthStep; ar[2] = lengthStep; double origin[3]; origin[0] = bbox.origin[0]; origin[1] = bbox.origin[1]; origin[2] = bbox.origin[2]; vtkStructuredPoints *strcP = vtkStructuredPoints::New(); // Set data dimensions, spacing and origin strcP->SetDimensions(dim); strcP->SetSpacing(ar); strcP->SetOrigin(origin); vtkDataSet *ds = strcP ; vtkDataSetAttributes *a = ds->GetPointData() ; // Data may be vtkUnsignedCharArray or vtkUnsignedShortArray vtkUnsignedCharArray *scalars = vtkUnsignedCharArray::New(); unsigned int cnt = 0; float zInit = origin[2]; for(int x = 0; x < steps; x++) { float xf = bbox.origin[0] + x*lengthStep; for(int y = 0; y < steps; y++) { float yf = bbox.origin[1] + y*lengthStep; vector<float> listT = getIntersectionPoints(xf,yf,zInit,geometry); if(listT.size() == 2) { float zIn = zInit + listT.at(0); float zOut = zInit + listT.at(1); bool particleAdded = false; for(int z = 0; z < steps; z++) { float zf = origin[2] + z*lengthStep; if(zf >= zIn && zf <= zOut) { scalars->InsertValue(cnt, 128) ; particleAdded = true; } else if(zf < zIn)scalars->InsertValue(cnt, 0) ; else if(zf > zOut && particleAdded == false) { scalars->InsertValue(cnt,128); particleAdded = true; } else scalars->InsertValue(cnt, 0) ; cnt++; } } else if(listT.size() == 4) { float zIn1 = zInit + listT.at(0); float zOut1 = zInit + listT.at(1); float zIn2 = zInit + listT.at(2); float zOut2 = zInit + listT.at(3); for(int z = 0; z < steps; z++) { float zf = origin[2] + z*lengthStep; if((z >= zIn1 && z <= zOut1) || (z >= zIn2 && z <= zOut2)) { scalars->InsertValue(cnt, 128); } else scalars->InsertValue(cnt, 0) ; cnt++; } } else { for(int z = 0; z < steps; z++) { scalars->InsertValue(cnt, 0) ; cnt++; } } } } a->SetScalars(scalars) ; return strcP; } > Date: Wed, 11 Nov 2009 10:33:06 -0500 > Subject: Re: [vtkusers] duplicated vertex in marching cubes? > From: bill.lorensen@... > To: dev_crisalix@... > CC: vtkusers@... > > Please provide a small, complete example. MC should not generate > duplicate points or vertices. What is the datatype of your scalars? > > On Wed, Nov 11, 2009 at 10:20 AM, lucas Grijander > <dev_crisalix@...> wrote: > > > > Hi all! > > I am using vtkMarchingCubes to calculate a 3D mesh of a volume I have. Fist > > I initialize the filter with: > > vtkMarchingCubes* iso = vtkMarchingCubes::New(); > > iso->SetInput(object); > > iso->SetValue(0,1); // Surface #0, iso-value=1 > > iso->Update(); > > then I fill the vtkStructuredPoints. > > The problem I have is, as you can see in the pictures, when you have a close > > look to the trianbles (screen2) you can see duplicated triangles and vertex, > > and this is a huge problem for my application... I supposed vtkMarchingCubes > > should generate a single surface mesh... I don't know if that's the reason, > > but when I fill the vtkStructuredPoints I use > > scalars->InsertValue(cnt, 0) ; and scalars->InsertValue(cnt, 128) ; > > I took all these from an example, I still don't know what you have to set as > > values, either 1 or 128... in addition the result change with this number > > and I'm not sure why. > > What should I use as values? and also why I have this "double" triangles > > mesh? > > thanks! > > Jaime. > > ________________________________ > > Windows Live: Make it easier for your friends to see what you’re up to on > > Facebook. > > ________________________________ > > Keep your friends updated— even when you’re not signed in. > > ________________________________ > > Windows Live: Friends get your Flickr, Yelp, and Digg updates when they > > e-mail you. > > _______________________________________________ > > 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 > > > > Windows Live: Keep your friends up to date with what you do online. _______________________________________________ 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 |
|
|
Re: duplicated vertex in marching cubes?Try iso->SetValue(0,64);
On Wed, Nov 11, 2009 at 10:40 AM, lucas Grijander <dev_crisalix@...> wrote: > This is my code. Basically I have a mesh "geometry" and I project rays in > order to fill the matrix of points. > *********************************** > vtkStructuredPoints *object = prepareVTKObjectForMarching(geom,40); > //Iso-surface using marching cubes > vtkMarchingCubes* iso = vtkMarchingCubes::New(); > iso->SetInput(object); > iso->SetValue(0,1); // Surface #0, iso-value=1 > iso->Update(); > then the function prepareVTKObjectForMarching > vtkStructuredPoints* prepareVTKObjectForMarching(osg::Geometry *geometry, > int steps, string name) > { > TBBox bbox = createBoundingBox(geometry); > bbox.length[0] *= 1.2; > bbox.length[1] *= 1.2; > bbox.length[2] *= 1.2; > float lengthStep = bbox.length[bbox.maxLAxis]/(float)steps; > int dim[3]; > dim[0] = steps; > dim[1] = steps; > dim[2] = steps; > double ar[3]; > ar[0] = lengthStep; > ar[1] = lengthStep; > ar[2] = lengthStep; > double origin[3]; > origin[0] = bbox.origin[0]; > origin[1] = bbox.origin[1]; > origin[2] = bbox.origin[2]; > vtkStructuredPoints *strcP = vtkStructuredPoints::New(); > // Set data dimensions, spacing and origin > strcP->SetDimensions(dim); > strcP->SetSpacing(ar); > strcP->SetOrigin(origin); > vtkDataSet *ds = strcP ; > vtkDataSetAttributes *a = ds->GetPointData() ; > // Data may be vtkUnsignedCharArray or vtkUnsignedShortArray > vtkUnsignedCharArray *scalars = vtkUnsignedCharArray::New(); > unsigned int cnt = 0; > > float zInit = origin[2]; > for(int x = 0; x < steps; x++) > { > float xf = bbox.origin[0] + x*lengthStep; > for(int y = 0; y < steps; y++) > { > float yf = bbox.origin[1] + y*lengthStep; > vector<float> listT = getIntersectionPoints(xf,yf,zInit,geometry); > if(listT.size() == 2) > { > float zIn = zInit + listT.at(0); > float zOut = zInit + listT.at(1); > bool particleAdded = false; > for(int z = 0; z < steps; z++) > { > float zf = origin[2] + z*lengthStep; > if(zf >= zIn && zf <= zOut) > { > scalars->InsertValue(cnt, 128) ; > particleAdded = true; > } > else if(zf < zIn)scalars->InsertValue(cnt, 0) ; > else if(zf > zOut && particleAdded == false) > { > scalars->InsertValue(cnt,128); > particleAdded = true; > } > else scalars->InsertValue(cnt, 0) ; > cnt++; > } > } > else if(listT.size() == 4) > { > float zIn1 = zInit + listT.at(0); > float zOut1 = zInit + listT.at(1); > float zIn2 = zInit + listT.at(2); > float zOut2 = zInit + listT.at(3); > for(int z = 0; z < steps; z++) > { > float zf = origin[2] + z*lengthStep; > if((z >= zIn1 && z <= zOut1) || (z >= zIn2 && z <= zOut2)) > { > scalars->InsertValue(cnt, 128); > } > else scalars->InsertValue(cnt, 0) ; > cnt++; > } > } > else > { > for(int z = 0; z < steps; z++) > { > scalars->InsertValue(cnt, 0) ; > cnt++; > } > } > } > } > a->SetScalars(scalars) ; > return strcP; > } > > >> Date: Wed, 11 Nov 2009 10:33:06 -0500 >> Subject: Re: [vtkusers] duplicated vertex in marching cubes? >> From: bill.lorensen@... >> To: dev_crisalix@... >> CC: vtkusers@... >> >> Please provide a small, complete example. MC should not generate >> duplicate points or vertices. What is the datatype of your scalars? >> >> On Wed, Nov 11, 2009 at 10:20 AM, lucas Grijander >> <dev_crisalix@...> wrote: >> > >> > Hi all! >> > I am using vtkMarchingCubes to calculate a 3D mesh of a volume I have. >> > Fist >> > I initialize the filter with: >> > vtkMarchingCubes* iso = vtkMarchingCubes::New(); >> > iso->SetInput(object); >> > iso->SetValue(0,1); // Surface #0, iso-value=1 >> > iso->Update(); >> > then I fill the vtkStructuredPoints. >> > The problem I have is, as you can see in the pictures, when you have a >> > close >> > look to the trianbles (screen2) you can see duplicated triangles and >> > vertex, >> > and this is a huge problem for my application... I supposed >> > vtkMarchingCubes >> > should generate a single surface mesh... I don't know if that's the >> > reason, >> > but when I fill the vtkStructuredPoints I use >> > scalars->InsertValue(cnt, 0) ; and scalars->InsertValue(cnt, 128) ; >> > I took all these from an example, I still don't know what you have to >> > set as >> > values, either 1 or 128... in addition the result change with this >> > number >> > and I'm not sure why. >> > What should I use as values? and also why I have this "double" triangles >> > mesh? >> > thanks! >> > Jaime. >> > ________________________________ >> > Windows Live: Make it easier for your friends to see what you’re up to >> > on >> > Facebook. >> > ________________________________ >> > Keep your friends updated— even when you’re not signed in. >> > ________________________________ >> > Windows Live: Friends get your Flickr, Yelp, and Digg updates when they >> > e-mail you. >> > _______________________________________________ >> > 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 >> > >> > > > ________________________________ > Windows Live: Keep your friends up to date with what you do online. 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 |
|
|
Re: duplicated vertex in marching cubes?I will probably irritate Bill by repeating again that yes, I do
(non-reproducibly :() use to get duplicate points from MC. To ensure robust results try to simply merge the duplicate points. Bill Lorensen wrote: > Please provide a small, complete example. MC should not generate > duplicate points or vertices. What is the datatype of your scalars? > > On Wed, Nov 11, 2009 at 10:20 AM, lucas Grijander > <dev_crisalix@...> wrote: >> Hi all! >> I am using vtkMarchingCubes to calculate a 3D mesh of a volume I have. Fist >> I initialize the filter with: >> vtkMarchingCubes* iso = vtkMarchingCubes::New(); >> iso->SetInput(object); >> iso->SetValue(0,1); // Surface #0, iso-value=1 >> iso->Update(); >> then I fill the vtkStructuredPoints. >> The problem I have is, as you can see in the pictures, when you have a close >> look to the trianbles (screen2) you can see duplicated triangles and vertex, >> and this is a huge problem for my application... I supposed vtkMarchingCubes >> should generate a single surface mesh... I don't know if that's the reason, >> but when I fill the vtkStructuredPoints I use >> scalars->InsertValue(cnt, 0) ; and scalars->InsertValue(cnt, 128) ; >> I took all these from an example, I still don't know what you have to set as >> values, either 1 or 128... in addition the result change with this number >> and I'm not sure why. >> What should I use as values? and also why I have this "double" triangles >> mesh? >> thanks! >> Jaime. >> ________________________________ >> Windows Live: Make it easier for your friends to see what you’re up to on >> Facebook. >> ________________________________ >> Keep your friends updated— even when you’re not signed in. >> ________________________________ >> Windows Live: Friends get your Flickr, Yelp, and Digg updates when they >> e-mail you. >> _______________________________________________ >> 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 >> >> > _______________________________________________ > 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 > _______________________________________________ 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 |
| Free embeddable forum powered by Nabble | Forum Help |