[vtkusers] help

Holger Weinacker holger.weinacker at felis.uni-freiburg.de
Thu Jul 29 13:41:37 EDT 2004


On Thu, 29 Jul 2004 09:47:48 -0400 (EDT)
 vtkusers-request at vtk.org wrote:
> Send vtkusers mailing list submissions to
> 	vtkusers at vtk.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.vtk.org/mailman/listinfo/vtkusers
> or, via email, send a message with subject or body 'help'
> to
> 	vtkusers-request at vtk.org
> 
> You can reach the person managing the list at
> 	vtkusers-owner at vtk.org
> 
> When replying, please edit your Subject line so it is
> more specific
> than "Re: Contents of vtkusers digest..."
> 
> 
> Today's Topics:
> 
>    1. ??: vtkusers Digest, Vol 3, Issue 89 (??)
>    2. change z coordinate (Vincent MEYER)
>    3. about the conflict between the new IO and the old
> IO (Yixun Liu)
>    4. Re: Re: 2d image extrude into 3d object (Chris
> Kennedy)
> 
> 
>
----------------------------------------------------------------------
> 
> Message: 1
> Date: Thu, 29 Jul 2004 20:40:47 +0800
> From: ?? <yhq at sjtu.edu.cn>
> Subject: [vtkusers] ??: vtkusers Digest, Vol 3, Issue 89
> To: <vtkusers at vtk.org>
> Message-ID: <20040729124108.2A3A07B0AEC at mx1.sjtu.edu.cn>
> Content-Type: text/plain;	charset="gb2312"
> 
> 
> 
> -----ÓʼþÔ­¼þ-----
> ·¢¼þÈË: vtkusers-bounces at vtk.org
> [mailto:vtkusers-bounces at vtk.org] ´ú±í
> vtkusers-request at vtk.org
> ·¢ËÍʱ¼ä: 2004Äê7ÔÂ29ÈÕ 16:50
> ÊÕ¼þÈË: vtkusers at vtk.org
> Ö÷Ìâ: vtkusers Digest, Vol 3, Issue 89
> 
> Send vtkusers mailing list submissions to
> 	vtkusers at vtk.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.vtk.org/mailman/listinfo/vtkusers
> or, via email, send a message with subject or body 'help'
> to
> 	vtkusers-request at vtk.org
> 
> You can reach the person managing the list at
> 	vtkusers-owner at vtk.org
> 
> When replying, please edit your Subject line so it is
> more specific
> than "Re: Contents of vtkusers digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: vtkInteractorStyle and animation (Akshay
> Sthapit)
>    2. Re: Re: MarchingCubes (Sean McInerney)
>    3. Take a look here for VTK! (Toth Istvan)
>    4. Re: Take a look here for VTK! (Sean McInerney)
>    5. Re: vtkPolyDataMapper2D + vtkCoordinate (Laurent
> Mundeleer)
>    6. problem with surface (Germain PRUNIER)
> 
> 
>
----------------------------------------------------------------------
> 
> Message: 1
> Date: Wed, 28 Jul 2004 19:02:17 -0700 (PDT)
> From: Akshay Sthapit <sthapit at yahoo.com>
> Subject: Re: [vtkusers] vtkInteractorStyle and animation
> To: seanm at nmr.mgh.harvard.edu
> Cc: vtkusers at vtk.org
> Message-ID:
> <20040729020217.76877.qmail at web60003.mail.yahoo.com>
> Content-Type: text/plain; charset=us-ascii
> 
> Genius!  That works :)  Thanks Sean.
> 
> Akshay
> 
> --- Sean McInerney <seanm at nmr.mgh.harvard.edu> wrote:
> > Akshay,
> > 
> >    It probably segfaults since the Style is not yet
> associated with
> > an 
> > Interactor. Try rearranging your code like this:
> > 
> > vtkInteractorStyle *style = vtkInteractorStyle::New();
> > vtkRenderWindowInteractor *iren =
> vtkRenderWindowInteractor::New();
> > iren->SetRenderWindow(renWin);
> > iren->SetInteractorStyle(style);
> > style->StartAnimate();
> > iren->Start();
> > 
> >    Does this work?
> > 
> > -Sean
> > 
> > Akshay Sthapit wrote:
> > > Can someone please tell me why the following code
> causes a crash? 
> > I'm
> > > trying to create a simple animation
> > > 
> > >
> ---------------------------------------------------------
> > > vtkInteractorStyle *style =
> vtkInteractorStyle::New();
> > > style->StartAnimate();
> > > 
> > > vtkRenderWindowInteractor *iren =
> vtkRenderWindowInteractor::New();
> > > iren->SetRenderWindow(renWin);
> > > iren->SetInteractorStyle(style);
> > > iren->Start();
> > >
>
----------------------------------------------------------
> > > 
> > > Thanks!
> > > Akshay
> > > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection
> around 
> http://mail.yahoo.com 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Wed, 28 Jul 2004 22:09:53 -0400
> From: Sean McInerney <seanm at nmr.mgh.harvard.edu>
> Subject: Re: [vtkusers] Re: MarchingCubes
> To: Jonathan Bailleul <Jonathan.Bailleul at greyc.ismra.fr>
> Cc: vtkusers at public.kitware.com,
> baghdadi at sickkids.ca,	Goodwin Lawlor
> 	<goodwin.lawlor at ucd.ie>
> Message-ID: <41085C71.8090500 at nmr.mgh.harvard.edu>
> Content-Type: text/plain; charset="us-ascii"
> 
> Jonathan,
> 
>    I'll check out your code.
>    In the meantime, I had a quicker and dirtier idea that
> I decided to 
> try out using vtkSurfaceReconstructionFilter and
> vtkImageThreshold to 
> produce an binary ImageData volume from a PolyData
> surface. It's rough 
> but interesting. The output is a volume rendering.
> 
> -Sean
> 
> Jonathan Bailleul wrote:
> > Sean McInerney wrote:
> > 
> >>Jonathan,
> >>
> >>   That's a cool idea!
> >>
> >>   Foreach desired slice plane for the ImageData volume
> that you will
> >>ultimately produce, do something like this:
> >>
> >>1.) Use vtkClipPolyData to get the 2D contour of the
> given slice.
> >>
> >>2.) Use vtkPolyDataToImageStencil to produce
> ImageStencilData
> >>
> >>3.) Use vtkImageStencil to produce the ImageData
> >>     (need to do a little filtering to produce the
> desired binary image).
> >>
> >>4.) Use vtkAppendFilter to fuse the 2D binary images
> into a 3D volume.
> >>     Hopefully, the ImageStencilData retains a 3D
> extent.
> >>
> >>5.) Voila! Binary volume from PolyData ... maybe.
> >>
> >>-Sean
> > 
> > 
> > 
> > Thanks for the help!
> > 
> > If someone is inspirated to actually implement this (or
> has already
> > completed this), please notify me!
> > Anyway, here is a stupid but working solution. Code is
> sometimes ugly,
> > but it works (only voxels at border of each slice are
> "colored"). Output
> > is AIR analyse format, recognized on ITK and usable on
> VTK if you know
> > the parameters and consider the .img file as the raw
> volume.
> > 
> > All personal includes in:
> >
>
http://www.greyc.ismra.fr/~bailleul/Ressources/summary.html
> (see gpl
> > code section)
> > for those who really want to end up testing the
> program.
> > 
> > I really should have been more investigating on VTK
> abilities before
> > doing all this by hand, but I was VTK newbie when I
> coded this and had
> > most of the necessary code at hand on my personal
> libraries.
> > 
> > 
> -------------- next part --------------
> // VTK Common
> #include "vtkPolyData.h"
> #include "vtkImageData.h"
> #include "vtkPiecewiseFunction.h"
> #include "vtkColorTransferFunction.h"
> // VTK Imaging
> #include "vtkSurfaceReconstructionFilter.h"
> #include "vtkImageThreshold.h"
> #include "vtkImageToStructuredPoints.h"
> // VTK Graphics
> #include "vtkOutlineFilter.h"
> // VTK IO
> #include "vtkBYUReader.h"
> // VTK Rendering
> #include "vtkPolyDataMapper.h"
> #include "vtkProperty.h"
> #include "vtkActor.h"
> #include "vtkVolumeRayCastCompositeFunction.h"
> #include "vtkVolumeRayCastMapper.h"
> #include "vtkVolumeProperty.h"
> #include "vtkVolume.h"
> #include "vtkRenderer.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> 
> int
> main (int argc, char* argv[])
> {
>   const char* dataRoot = getenv("VTK_DATA_ROOT");
> 
>   if (dataRoot == NULL)
>     {
>     cerr << "Must set VTK_DATA_ROOT!" << endl;
>     return 0;
>     }
> 
>   const char* subdir = "/Data/";
>   const char* file1 = "Viewpoint/cow.g";
>   char* path1 = new char
> [strlen(dataRoot)+strlen(subdir)+strlen(file1)+1];
> 
>   strcpy(path1, dataRoot);
>   strcat(path1, subdir);
>   strcat(path1, file1);
> 
>   double length;
>   double range[2];
>   double bounds[6];
>   int extent[6];
> 
>   vtkRenderer* ren1 = vtkRenderer::New();
>   vtkRenderWindow* renWin = vtkRenderWindow::New();
>     {
>     renWin->AddRenderer(ren1);
>     renWin->SetSize(300,300);
>     ren1->Delete();
>     }
>   vtkRenderWindowInteractor* iren =
> vtkRenderWindowInteractor::New();
>     {
>     iren->SetRenderWindow(renWin);
>     renWin->Delete();
>     }
> 
>   vtkImageData* imageData = vtkImageData::New();
>     {
>     vtkSurfaceReconstructionFilter* surfaceRecon =
>       vtkSurfaceReconstructionFilter::New();
>       {
>       vtkBYUReader* reader = vtkBYUReader::New();
>         {
>         reader->SetGeometryFileName(path1);
>         reader->Update();
>         }
>       surfaceRecon->SetInput(reader->GetOutput());
>       surfaceRecon->SetNeighborhoodSize(10);
>  
>
surfaceRecon->SetSampleSpacing(reader->GetOutput()->GetLength()/100.0);
>       surfaceRecon->Update();
>       reader->Delete();
>       }
>     imageData->DeepCopy(surfaceRecon->GetOutput());
>     surfaceRecon->Delete();
>     }
> 
>   vtkActor* outlineActor = vtkActor::New();
>     {
>     vtkPolyDataMapper* outlineMapper =
> vtkPolyDataMapper::New();
>       {
>       vtkOutlineFilter* outlineFilter =
> vtkOutlineFilter::New();
>         {
>         outlineFilter->SetInput(imageData);
>         }
>
      outlineMapper->SetInput(outlineFilter->GetOutput());
>       outlineFilter->Delete();
>       }
>     outlineActor->SetMapper(outlineMapper);
>     outlineMapper->Delete();
>     }
>   ren1->AddProp(outlineActor);
>   outlineActor->Delete();
> 
>   renWin->Render();
> 
>   vtkVolume* volume = vtkVolume::New();
>     {
>     vtkVolumeRayCastMapper* volumeMapper =
> vtkVolumeRayCastMapper::New();
>       {
>       vtkVolumeRayCastCompositeFunction*
> compositeFunction =
>         vtkVolumeRayCastCompositeFunction::New();
>       vtkImageThreshold* imageThreshold =
> vtkImageThreshold::New();
>         {
>         imageThreshold->SetInput(imageData);
>         imageThreshold->ReplaceInOn();
>         imageThreshold->ReplaceOutOn();
>         imageThreshold->SetInValue(1.0);
>         imageThreshold->SetOutValue(0.0);
>         imageThreshold->ThresholdByLower(0.0);
>
        imageThreshold->SetOutputScalarTypeToUnsignedChar();
>         }
>
      volumeMapper->SetVolumeRayCastFunction(compositeFunction);
>
      volumeMapper->SetInput(imageThreshold->GetOutput());
>       imageThreshold->Delete();
>       }
>     vtkVolumeProperty* volumeProperty =
> vtkVolumeProperty::New();
>       {
>       // Create transfer mapping scalar value to opacity
>       vtkPiecewiseFunction* opacityTF =
> vtkPiecewiseFunction::New();
>         {
>         opacityTF->AddPoint(0.0, 0.167);
>         opacityTF->AddPoint(1.0, 0.667);
>         opacityTF->ClampingOn();
>         }
>       // Create transfer mapping scalar value to color
>       vtkColorTransferFunction* colorTF =
> vtkColorTransferFunction::New();
>         {
>         colorTF->AddHSVPoint(0.0, 0.00, 1.0, 1.0);
>         colorTF->AddHSVPoint(1.0, 0.50, 1.0, 1.0);
>         }
>       volumeProperty->SetColor(colorTF);
>       volumeProperty->SetScalarOpacity(opacityTF);
>       volumeProperty->SetInterpolationTypeToLinear();
>       opacityTF->Delete();
>       colorTF->Delete();
>       }
>     volume->SetMapper(volumeMapper);
>     volume->SetProperty(volumeProperty);
>     volumeMapper->Delete();
>     volumeProperty->Delete();
>     }
>   ren1->AddProp(volume);
>   volume->Delete();
> 
>   renWin->Render();
> 
>   iren->Start();
> 
>   iren->Delete();
>   imageData->Delete();
> 
>   delete [] path1;
> 
>   return 0;
> }
> 
> ------------------------------
> 
> Message: 3
> Date: Thu, 29 Jul 2004 09:31:57 -0700
> From: "Toth Istvan" <istvan at dmmd.net>
> Subject: [vtkusers] Take a look here for VTK!
> To: <vtkusers at vtk.org>
> Message-ID: <005b01c47589$976a9350$085a1e0a at Istvan>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi
> I have a problem with a VTK file.
> I don't know if it is a valid VTK file format..
> I try to open with ParaView but I can't view it..
> Take a look for this file , from:
> http://www.geocities.com/istynet/vtk.zip  
> If you can help me please reply!
> Istvan
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>
http://public.kitware.com/pipermail/vtkusers/attachments/20040729/ff861b22/a
> ttachment.htm
> 
> ------------------------------
> 
> Message: 4
> Date: Thu, 29 Jul 2004 03:12:53 -0400
> From: Sean McInerney <seanm at nmr.mgh.harvard.edu>
> Subject: Re: [vtkusers] Take a look here for VTK!
> To: vtkusers at vtk.org
> Message-ID: <4108A375.2040707 at nmr.mgh.harvard.edu>
> Content-Type: text/plain; charset=us-ascii; format=flowed
> 
> Is it just me, or could a request to the list possibly
> look more 
> suspect? This does not seem to be a valid VTK file! I'm
> wary of anything 
> stinking of an invalid request and zipped. If I am just
> being paranoid, 
> please accept my apologies.
> 
> -Sean
> 
> Toth Istvan wrote:
> > Hi
> > I have a problem with a VTK file.
> > I don't know if it is a valid VTK file format..
> > I try to open with ParaView but I can't view it..
> > Take a look for this file , from:
> http://www.geocities.com/istynet/vtk.zip
> 
> > If you can help me please reply!
> > Istvan
> > 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Thu, 29 Jul 2004 09:51:37 +0200
> From: Laurent Mundeleer <lmundele at ulb.ac.be>
> Subject: [vtkusers] Re: vtkPolyDataMapper2D +
> vtkCoordinate
> To: vtk <vtkusers at vtk.org>
> Message-ID: <4108AC89.4090207 at ulb.ac.be>
> Content-Type: text/plain; charset=ISO-8859-1;
> format=flowed
> 
> Hello all,
> I was thinking, maybe should I use SetClippingPlanes()
> instead of 
> vtkCoordinate()?
> There must be a simple way to render polyData in 2D
> easely...
> 
> Thanks,
> Best Regards,
> 
> Laurent
> 
> Laurent Mundeleer wrote:
> 
> > Hello all,
> > I've a 3D scene with several polyDatas, I visualize it
> in 3D.
> > I'd like to have 2D views of it, so I use
> vtkPolyDataMapper2D.
> > With default values, it's ok, I have one 2D view.
> > But I'd like to have 3 differents 2D views of the same
> 3D scene, so 
> > the mapper2D has to take projections from differents
> points of view (3 
> > orthogonal planes for example).
> > I don't know how to use vtkCoordinate to have this
> working...
> >
> > Thanks for any help,
> > Regards,
> >
> > Laurent
> >
> 
> -- 
> ********************************************
> Laurent Mundeleer
> Universiti Libre de Bruxelles (ULB)
> Service des Systhmes Logiques et Numiriques (SLN)
> CP165/57
> 50, Av. F.Roosevelt
> 1050 Bruxelles
> Belgium
> tel : ++32.2.650.22.97
> fax : ++32.2.650.22.98
> e-mail : lmundele at ulb.ac.be
> ********************************************
> 
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Thu, 29 Jul 2004 10:49:44 +0200
> From: "Germain PRUNIER" <Germain.PRUNIER at cerealog.fr>
> Subject: [vtkusers] problem with surface
> To: <vtkusers at vtk.org>
> Message-ID:
>
<48005AA56235E547B719C751B2E05C9837A3DB at terra.cerealog.fr>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> 
> Hi all,
> 
> I would like to display a surface from a cloud of points.
> I tried vtkDelaunay3D and vtkSurfaceReconstructionFilter
> but for both
> methods I get unpleasant results.
> 
> I attached some pictures that presents the cloud of
> points, and the result
> with the 2 methods...
> 
> I think that some of you could help me. It seems not to
> be really difficult
> but I don't know how to do that!
> 
> Please, where are my problems ??
> 
> Thank you!
> Germain
> 
> 
> 
>  <<cloud_points.jpg>>  <<cloud_points2.jpg>>
>  <<Delaunay3D.jpg>>
> <<SurfaceReconstructionFilter.jpg>> 
> 
> 
> //with vtkDelaunay3D, I wrote:
> 
> 
> vtkDelaunay3D *delpts = vtkDelaunay3D::New();
>     delpts->SetInput(data);
>                                   //data: my
> points
>     delpts->SetTolerance(0.01);
>     delpts->SetAlpha(0.0);
> 
> vtkDataSetMapper *cloudMapper2 = vtkDataSetMapper::New();
>     cloudMapper->SetInput(delpts->GetOutput());
> 
> .....
> 
> 
>
**********************************************************
> //with vtkSurfaceReconstructionFilter:
> 
> vtkSurfaceReconstructionFilter *surf =
> vtkSurfaceReconstructionFilter::New();
> 	surf->SetInput(data);
> 
> vtkContourFilter *cf = vtkContourFilter::New();
>     cf->SetInput((vtkDataSet*)surf->GetOutput());
>     cf->SetValue(0,0.0);
> 
> vtkReverseSense *reverse = vtkReverseSense::New();
>    reverse->SetInput(cf->GetOutput());
>    reverse->ReverseCellsOn();
>    reverse->ReverseNormalsOn();
>    reverse->Update();
> 	
> vtkPolyDataMapper *cloudMapper =
> vtkPolyDataMapper::New();
>    cloudMapper->SetInput(reverse->GetOutput());
> 
> ...
> 
> 
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: cloud_points.jpg
> Type: image/jpeg
> Size: 13070 bytes
> Desc: cloud_points.jpg
> Url :
>
http://public.kitware.com/pipermail/vtkusers/attachments/20040729/152849bb/c
> loud_points.jpg
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: cloud_points2.jpg
> Type: image/jpeg
> Size: 10386 bytes
> Desc: cloud_points2.jpg
> Url :
>
http://public.kitware.com/pipermail/vtkusers/attachments/20040729/152849bb/c
> loud_points2.jpg
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: Delaunay3D.jpg
> Type: image/jpeg
> Size: 22713 bytes
> Desc: Delaunay3D.jpg
> Url :
>
http://public.kitware.com/pipermail/vtkusers/attachments/20040729/152849bb/D
> elaunay3D.jpg
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: SurfaceReconstructionFilter.jpg
> Type: image/jpeg
> Size: 19865 bytes
> Desc: SurfaceReconstructionFilter.jpg
> Url :
>
http://public.kitware.com/pipermail/vtkusers/attachments/20040729/152849bb/S
> urfaceReconstructionFilter.jpg
> 
> ------------------------------
> 
> _______________________________________________
> vtkusers mailing list
> vtkusers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> End of vtkusers Digest, Vol 3, Issue 89
> ***************************************
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Thu, 29 Jul 2004 12:57:19 +0000
> From: "Vincent MEYER" <meyer20_100 at hotmail.com>
> Subject: [vtkusers] change z coordinate
> To: vtkusers at vtk.org
> Message-ID: <BAY15-F20VtI9P9mg6O000d033b at hotmail.com>
> Content-Type: text/plain; charset=iso-8859-1;
> format=flowed
> 
> Hi All,
> 
> I'd like to know if there is a mean to change the z
> coordinate of points of 
> a dataset with a scalar point attribute in order to see
> the different scalar 
> values in 3D.
> 
> Thanks a lot.
> 
> Vincent
> 
>
_________________________________________________________________
> Hotmail : bientôt 250 Mo de stockage ! 
> http://www.imagine-msn.com/hotmail/fr-fr/
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Thu, 29 Jul 2004 21:39:51 +0800
> From: Yixun Liu <yxliu at fudan.edu.cn>
> Subject: [vtkusers] about the conflict between the new IO
> and the old
> 	IO
> To: vtkusers at vtk.org, insight-users at itk.org
> Message-ID: <000e01c47571$8642de60$1f64a8c0 at YXLIU>
> Content-Type: text/plain; charset="gb2312"
> 
> Hi ITKUsers and VTKusers,
> 
>             I need use ITK+VTK, so I build them both with
> the "use_ansi_stdlib" ON. However, one of my programs
> which once worked fine with the VTK(the parameter
> "use_ansi_lib" is Off) can not work. The compile error
> is:
> 
> C:\Program Files\Microsoft Visual
> Studio\VC98\INCLUDE\ios.h(104) : error C2371: 'ostream' :
> redefinition; different basic types
> C:\Program Files\Microsoft Visual
> Studio\VC98\INCLUDE\iosfwd(257) : see declaration of
> 'ostream'
> 
> I think the reason is that the conflict between the new
> IO and the old IO, so I add the #undef
> VTK_USE_ANSI_STDLIB in my program, but the compiler
> report the same error. If I build the VTK with the
> "use_ansi_lib" Off and add the #define
> VTK_USE_ANSI_STDLIB in my programm, I think, I can
> resolve this problem. However, I need use the VTK with
> the ITK, if I build the VTK with 'use_ansi_lib" Off, I
> have to build the ITK with the same configuration. I do
> not want to do like this.  Can I have other choices to
> resolve the conflict between the old IO and the new IO?
> 
> Thank you in advance!
> 
> Best regards,
> 
> Yixun Liu
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>
http://public.kitware.com/pipermail/vtkusers/attachments/20040729/272bd386/attachment-0001.htm
> 
> ------------------------------
> 
> Message: 4
> Date: Thu, 29 Jul 2004 09:47:14 -0400
> From: Chris Kennedy <vtk072404 at thinkpeak.com>
> Subject: Re: [vtkusers] Re: 2d image extrude into 3d
> object
> To: Goodwin Lawlor <goodwin.lawlor at ucd.ie>
> Cc: vtkusers at vtk.org
> Message-ID: <4108FFE2.2020602 at thinkpeak.com>
> Content-Type: text/plain; charset="us-ascii"
> 
> hi Goodwin,
> Thanks for the help. I was able to get the images into a
> 3d set of 
> surfaces.
> 
> If you revisit the URL I have png2.* and region2.tcl,
> segmented1.tcl  
> that construct the model. I've also implemented
> vtkImageShrink3D which 
> makes it feasible to do some of the large image sizes.
> 
> thanks
> 
> Goodwin Lawlor wrote:
> 
> > Hi Chris
> >  
> > I looked at your images png.0.png ... png.9.png. The
> image dimensions 
> > are 2800 x 2100 and each one looks like they contain
> multiple slices 
> > rather than just one. The file pattern for these is
> "%s.%d.png"
> >  
> > MCubes will automatically cap the geometry if you add a
> (in your case) 
> > a white slice, above and below your volume.
> >  
> > MCubes expect the background of a volume to be black
> and the body to 
> > be white, ie, the opposite to what you have. This will
> effect the 
> > "sidedness" or normals of the triangles created. You
> could use 
> > vtkImageThreshold to invert the volume (set tissue
> value to 0) or play 
> > around with vtkImageMathematics to do the same.
> >  
> > hth
> >  
> > Goodwin
> >
> >     ----- Original Message -----
> >     From: Chris Kennedy
> <mailto:vtk072404 at thinkpeak.com>
> >     To: Goodwin Lawlor <mailto:goodwin.lawlor at ucd.ie>
> >     Cc: vtkusers at vtk.org <mailto:vtkusers at vtk.org>
> >     Sent: Wednesday, July 28, 2004 6:48 PM
> >     Subject: Re: [vtkusers] Re: 2d image extrude into
> 3d object
> >
> >     hi Goodwin,
> >     Thanks for the reply, although you've confused me
> with what I
> >     should do with my data. 
> >
> >     I reduced all the images down to 10% of their
> original size. Now
> >     I'm using this tcl script, basically going from
> reader directly
> >     into marching cubes. I get some geometry in my Viz
> window, cool!.
> >
> >     What are the commands to cap the geometry? ie, for
> each x-section
> >     that is extruded into 3d I want the not only the
> surfaces
> >     representing the Z direction walls, but also the
> surfaces in the
> >     x-section plane.
> >
> >     # A script to reconstruct surfaces from segmented
> images
> >     # Adapted from Bill Lorensen's segmented16.tcl,
> >     http://www.crd.ge.com/~lorensen/seg12/
> >     # Goodwin Lawlor, 2004
> >
> >     package require vtk
> >     wm withdraw .
> >     wm protocol . WM_DELETE_WINDOW {vtkCommand
> DeleteAllObjects; exit}
> >
> >
> >     vtkPNGReader reader
> >         reader SetFilePrefix "./png"
> >         reader SetFilePattern %s.%d
> >         reader SetDataExtent 0 255 0 255 1 9
> >         reader SetDataScalarTypeToShort
> >         # data is in acsii, space delimited format
> >         # this data mask is just a trick to cut out the
> space.
> >         #reader SetDataMask 0x00FF
> >         reader SetDataByteOrderToLittleEndian
> >         reader SetDataSpacing 1.0 1.0 10.0
> >         # decimator complains so...
> >         #reader GlobalWarningDisplayOff
> >
> >
> >     vtkImageThreshold selectTissue
> >         selectTissue SetInput [reader GetOutput]
> >         selectTissue SetInValue 255
> >         selectTissue SetOutValue 0
> >         selectTissue ReplaceInOn
> >         selectTissue ReplaceOutOn
> >
> >     vtkImageShrink3D shrinker
> >          #shrinker SetInput [selectTissue GetOutput]
> >          shrinker SetInput [reader GetOutput]
> >          shrinker SetShrinkFactors 1 1 1
> >          shrinker AveragingOn
> >
> >     vtkImageGaussianSmooth gaussian
> >         gaussian SetInput [shrinker GetOutput]
> >         gaussian SetDimensionality 3
> >         gaussian SetStandardDeviation  0 0 0
> >
> >
> >     vtkMarchingCubes mcubes;
> >         #mcubes SetInput [gaussian GetOutput]
> >         #mcubes SetInput [shrinker GetOutput]
> >         mcubes SetInput [reader GetOutput]
> >         mcubes ComputeScalarsOff
> >         mcubes ComputeGradientsOff
> >         mcubes ComputeNormalsOff
> >         mcubes SetValue 0 127.5
> >
> >     vtkDecimate decimator
> >         decimator SetInput [mcubes GetOutput]
> >         decimator SetInitialFeatureAngle 60
> >         decimator SetMaximumIterations 5
> >         decimator SetMaximumSubIterations 0
> >         decimator PreserveEdgesOn
> >         decimator SetMaximumError 1.0
> >         decimator SetTargetReduction 0.95
> >         decimator SetInitialError 0.0002
> >         decimator SetErrorIncrement 0.0002
> >
> >     vtkWindowedSincPolyDataFilter smoother
> >         smoother SetInput [decimator GetOutput]
> >         smoother SetNumberOfIterations 20
> >         smoother SetPassBand 0.1
> >         smoother SetFeatureAngle 60
> >         smoother FeatureEdgeSmoothingOff
> >         smoother NonManifoldSmoothingOff;
> >
> >     vtkPolyDataNormals normals
> >         #normals SetInput [smoother GetOutput]
> >         normals SetInput [decimator GetOutput]
> >         normals SetFeatureAngle 60
> >
> >     vtkStripper stripper
> >         stripper SetInput [normals GetOutput]
> >
> >     vtkXMLPolyDataWriter writer
> >         writer SetInput [stripper GetOutput]
> >
> >     # Write and render the models
> >
> >     vtkRenderer ren
> >     vtkMath math
> >     set tissue 0
> >     #foreach tissue {0 } {
> >     # write the models to file
> >         #selectTissue ThresholdBetween $tissue $tissue
> >         #reader.Update()
> >         writer SetFileName model$tissue.vtp
> >         writer Write
> >
> >     #create readers, mappers, and actors
> >     vtkXMLPolyDataReader reader$tissue
> >         reader$tissue SetFileName model$tissue.vtp
> >
> >     vtkPolyDataMapper mapper$tissue
> >         mapper$tissue SetInput [reader$tissue
> GetOutput]
> >
> >     vtkProperty prop$tissue
> >         prop$tissue SetDiffuseColor [math Random] [math
> Random] [math
> >     Random]
> >         prop$tissue SetSpecularPower 50
> >         prop$tissue SetSpecular .5
> >         prop$tissue SetDiffuse .8
> >
> >     vtkActor actor$tissue
> >         actor$tissue SetMapper mapper$tissue
> >         actor$tissue SetProperty prop$tissue
> >
> >     ren AddActor actor$tissue
> >     #}
> >
> >     vtkRenderWindow renWin
> >         renWin AddRenderer ren
> >         renWin SetSize 600 600
> >     vtkRenderWindowInteractor iren
> >         iren SetRenderWindow renWin
> >         iren Initialize
> >            
> >        
> >
> >
> >     thanks
> >
> >     Goodwin Lawlor wrote:
> >
> >>Hi Chris,
> >>
> >>Your images are already binary (black and white) so you
> dont need
> >>vtkImageThreshold. In segemented.tcl you should use
> vtkPNGReader. Try to get
> >>your data into either one 3D image or multiple 2D
> (single) cross-sections.
> >>
> >>hth
> >>
> >>Goodwin
> >>
> >>"Chris Kennedy" <vtk072404 at thinkpeak.com> wrote in
> message
> >>news:4107C8F4.8010404 at thinkpeak.com...
> >>  
> >>
> >>>hi,
> >>>I'd like to take several 2d images that represent
> cross-sections at
> >>>different elevations through an object. I have PNG
> files that are black
> >>>and white, with black being the "metal" content in the
> object.  I only
> >>>want to take the black pixels and extrude them some
> distance. I have
> >>>several different X-sections and I will  take them
> into GoFly for some
> >>>assembly/collision work.
> >>>
> >>>Each x-section is standalone, in that it doesn't have
> to be averaged
> >>>into the x-section above or below it.
> >>>
> >>>I've been trying to follow the seg12 example
> >>>http://www.crd.ge.com/~lorensen/seg12/ using python
> instead. I have vtk
> >>>recompiled with the required patented methods also. I
> get an error
> >>>
> >>>ERROR: In C:\apps\VTK42\Patented\vtkMarchingCubes.cxx,
> line 420
> >>>vtkMarchingCubes (0x01E03640): Cannot contour data of
> dimension != 3
> >>>
> >>>thus I'm not applying a proper filter to the image.
> >>>I suspect in I need to specify additional operations
> to get the image
> >>>into a proper 3d format.  I don't understand what
> input the
> >>>SetVectorInput option needs, for instance or if it is
> applicable here.
> >>>
> >>>At http://www.thinkpeak.com/cust/vtk/ I have sample
> png files and 2 tcl
> >>>files.  The tcl files are similiar to what Goodwin
> posted to help Vidya,
> >>>but I haven't been able to get that configured
> properly either...
> >>>
> >>>here is the python code:
> >>>
> >>>#!/usr/bin/env python
> >>>
> >>>
> >>>fname='m10'
> >>>slice_order='is'
> >>>#file_pattern=%s.png
> >>>#study=.
> >>>pixel_size=1.0
> >>>spacing=100.0
> >>>start_slice=10
> >>>end_slice=19
> >>>zmax=end_slice-start_slice
> >>>#voi="0=255=0=255=0=$zmax"
> >>>sample_rate="1 1 1"
> >>>decimate_reduction=.95
> >>>decimate_iterations=5
> >>>decimate_error=.0002
> >>>decimate_error_increment=.0002
> >>>decimate_angle=60
> >>>smooth_iterations=0
> >>>smooth_expand=-.34
> >>>smooth_shrink=.33
> >>>smooth_factor=.1
> >>>smooth_angle=60
> >>>feature_angle=60
> >>>gaussian_standard_deviation=2
> >>>
> >>>import vtk
> >>>from vtk.util.misc import vtkGetDataRoot
> >>>VTK_DATA_ROOT = vtkGetDataRoot()
> >>>
> >>># Create the image
> >>>reader = vtk.vtkPNGReader()
> >>>reader.SetFilePrefix("./png")
> >>>reader.SetFilePattern('%s.%d')
> >>>reader.SetDataSpacing(0.8, 0.8, 1.5)
> >>>#reader.SetFileName(VTK_DATA_ROOT +
> "/Data/fran_cut.png")
> >>>reader.SetDataByteOrderToLittleEndian()
> >>>reader.SetDataExtent(0,255,0,255,1,9,)
> >>>reader.SetDataScalarTypeToShort()
> >>>reader.SetDataSpacing(1, 1, 100)
> >>>#reader.SetDataMask(0x7fff)
> >>>
> >>>#
> >>># select the metal, two rgb values in png file:
> >>># 255 - white
> >>># 0 - black
> >>>selectMetal=vtk.vtkImageThreshold()
> >>>selectMetal.ReleaseDataFlagOff()
> >>>selectMetal.ReplaceInOn()
> >>>selectMetal.ReplaceOutOn()
> >>>selectMetal.ThresholdBetween(0,0)
> >>>selectMetal.SetInValue(0)
> >>>selectMetal.SetOutValue(0)
> >>>selectMetal.SetInput(reader.GetOutput())
> >>>#selectMetal.Print()  # what's proper syntax?
> >>>
> >>>
> >>># I don't think I need this action...
> >>>gaussian=vtk.vtkImageGaussianSmooth()
> >>>gaussian.SetDimensionality(3)
>
>>>gaussian.SetStandardDeviation(gaussian_standard_deviation)
> >>>gaussian.SetInput(selectMetal.GetOutput())
> >>>#gaussian.Print()    # what's the syntax?
> >>>
> >>>toStructuredPoints=vtk.vtkImageToStructuredPoints()
> >>>toStructuredPoints.SetInput(gaussian.GetOutput())
> >>>#toStructuredPoints.SetVectorInput(10)
> >>># need more processing here... ie, how to specify
> thickness?
> >>>
> >>>mcubes=vtk.vtkMarchingCubes()
> >>>mcubes.SetInput(toStructuredPoints.GetOutput())
> >>>mcubes.ComputeScalarsOff()
> >>>mcubes.ComputeGradientsOff()
> >>>mcubes.ComputeNormalsOff()
> >>>mcubes.SetValue(0,0)
> >>>#mcubes.GetOutput()
> >>>
> >>>decimator=vtk.vtkDecimate()
> >>>decimator.SetInput(mcubes.GetOutput())
> >>>decimator.SetInitialFeatureAngle(decimate_angle)
> >>>decimator.SetMaximumIterations(decimate_iterations)
> >>>decimator.SetMaximumSubIterations(0)
> >>>decimator.PreserveEdgesOn()
> >>>decimator.SetMaximumError(1)
> >>>decimator.SetTargetReduction(decimate_reduction)
> >>>decimator.SetInitialError(decimate_error)
> >>>decimator.SetErrorIncrement(decimate_error_increment)
> >>>
> >>>smoother=vtk.vtkSmoothPolyDataFilter()
> >>>smoother.SetInput(decimator.GetOutput())
> >>>smoother.SetNumberOfIterations(smooth_iterations)
> >>>smoother.SetRelaxationFactor(smooth_factor)
> >>>smoother.SetFeatureAngle(smooth_angle)
> >>>smoother.FeatureEdgeSmoothingOff()
> >>>smoother.BoundarySmoothingOff()
> >>>smoother.SetConvergence(0)
> >>>
> >>>normals=vtk.vtkPolyDataNormals()
> >>>normals.SetInput(smoother.GetOutput())
> >>>normals.SetFeatureAngle(feature_angle)
> >>>
> >>>stripper=vtk.vtkStripper()
> >>>stripper.SetInput(normals.GetOutput())
> >>>
> >>>writer=vtk.vtkPolyDataWriter()
> >>>writer.SetInput(stripper.GetOutput())
> >>>writer.SetFileName(fname+'.vtk')
> >>>writer.SetFileType(2)
> >>>
> >>>mapOutline = vtk.vtkPolyDataMapper()
> >>>mapOutline.SetInput(stripper.GetOutput())
> >>>outline = vtk.vtkActor()
> >>>outline.SetMapper(mapOutline)
> >>>outline.GetProperty().SetColor(0, 0, 0)
> >>>
> >>>
> >>>reader.Update()
> >>>#shiftScale.Update()
> >>>selectMetal.Update()
> >>>#wpng.Update()
> >>>gaussian.Update()
> >>>toStructuredPoints.Update()
> >>>#mcubes.Update()
> >>>#decimator.Update()
> >>>#smoother.Update()
> >>>#normals.Update()
> >>>#stripper.Update()
> >>>
> >>>
> >>>aCamera = vtk.vtkCamera()
> >>>aCamera.SetViewUp(0, 0, -1)
> >>>aCamera.SetPosition(1, 1, 1)
> >>>aCamera.SetFocalPoint(0, 0, 0)
> >>>aCamera.ComputeViewPlaneNormal()
> >>>
> >>>
> >>>
> >>>ia = vtk.vtkImageActor()
> >>>#ia.SetInput(shiftScale.GetOutput())
> >>>ia.SetInput(selectMetal.GetOutput())
> >>>
> >>># Create the RenderWindow, Renderer and both Actors
> >>>ren = vtk.vtkRenderer()
> >>>renWin = vtk.vtkRenderWindow()
> >>>renWin.AddRenderer(ren)
> >>>iren = vtk.vtkRenderWindowInteractor()
> >>>iren.SetRenderWindow(renWin)
> >>>iren.Initialize()
> >>>
> >>># Actors are added to the renderer. An initial camera
> view is created.
> >>># The Dolly() method moves the camera towards the
> FocalPoint,
> >>># thereby enlarging the image.
> >>>ren.AddActor(outline)
> >>>ren.SetActiveCamera(aCamera)
> >>>ren.ResetCamera()
> >>>aCamera.Dolly(1.5)
> >>>
> >>># Add the actors to the renderer, set the background
> and size
> >>>ren.AddActor(ia)
> >>>ren.SetBackground(0.14, 0.2, 0.4)
> >>>renWin.SetSize(300, 300)
> >>>
> >>>renWin.Render()
> >>>
> >>>cam1 = ren.GetActiveCamera()
> >>>
> >>>ren.ResetCameraClippingRange()
> >>>
> >>>renWin.Render()
> >>>iren.Start()
> >>>
> >>>
>
>>>=======================================================
> >>>
> >>>How do I select pixels of a certain value from the
> image?
> >>>What processing needs to be done so that the data can
> be operated on by
> >>>MarchingCubes?
> >>>
> >>>I would like to get an assembly of these stacked
> images (converted into
> >>>3d objects), and then  do  additional geometry
> definitions and then take
> >>>it into  GoFly.
> >>>Extensions I'd like to make to this:
> >>>   - each image x-section may have a unique thickness
> >>>   - the x-section in image png.9 actually represent
> spheres, not
> >>>cylinders.
> >>>   - I want to define additional rectangular volumes,
> and spline tubes
> >>>and have this in the assembly file that is generated
> also
> >>>   - names (metadata) assigned here and carried
> forward into GoFly
> >>>
> >>>Thanks for any assistance.
> >>>
> >>>Chris Kennedy
> >>>Think Peak, Inc.
> >>>
> >>>
> >>>
> >>>
> >>>_______________________________________________
> >>>This is the private VTK discussion list.
> >>>Please keep messages on-topic. Check the FAQ at:
> >>>    
> >>>
> >><http://public.kitware.com/cgi-bin/vtkfaq>
> >>  
> >>
> >>>Follow this link to subscribe/unsubscribe:
> >>>http://www.vtk.org/mailman/listinfo/vtkusers
> >>>
> >>>    
> >>>
> >>
> >>
> >>
> >>_______________________________________________
> >>This is the private VTK discussion list. 
> >>Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> >>Follow this link to subscribe/unsubscribe:
> >>http://www.vtk.org/mailman/listinfo/vtkusers
> >>
> >>  
> >>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>
http://public.kitware.com/pipermail/vtkusers/attachments/20040729/0ef1d063/attachment.html
> 
> ------------------------------
> 
> _______________________________________________
> vtkusers mailing list
> vtkusers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> End of vtkusers Digest, Vol 3, Issue 90
> ***************************************




More information about the vtkusers mailing list