Ignore that last email, but not the one before that. I figured out the bug. scalars needs a name <http://permalink.gmane.org/gmane.comp.python.enthought.devel/28658>
I'm still confused why my data set is rotated and interprets the dataset in a different way. Also, in theory is there any difference between pipeline.volume(ImageData) as described above and this method: from vtk import vtkTIFFReader reader=vtkTIFFReader() reader.SetFileName(patchpath) reader.Update() image=reader.GetOutput() mlab.pipeline.volume(tvtk.to_tvtk(image)) The second method with vtkTIFFReader seems to give me a dense block instead of a volume that is mostly transparent, but maybe there is just some opacity setting I am missing. Thanks in anticipation, Chris On Fri, Jul 31, 2015 at 5:38 PM, Christopher Snyder <22csny...@gmail.com> wrote: > I've just noticed now, in addition to rendering what looks to be a correct > volume, I also get an error starting with : > ERROR: In > /home1/03176/csnyder/SourceCode/VTK5.10.1/Graphics/vtkAssignAttribute.cxx, > line 275 > vtkAssignAttribute (0x3854160): Data must be point or cell for vtkDataSet > > Chris > > On Fri, Jul 31, 2015 at 4:56 PM, Christopher Snyder <22csny...@gmail.com> > wrote: > >> Hi Gael, >> >> Thanks for your helpful comments. That method didn't work directly, but I >> was able to work around. For some reason, it would like me to report the >> x-dimension last to get a coherent image. >> >> #Image.shape=(34,74,74) >> s=tvtk.ImageData(dimensions=(34,74,74), spacing=(1,1,1),origin=(0,0,0) >> #Volume filter creates nonsense >> s=tvtk.ImageData(dimensions=(74,74,34), spacing=(1,1,1),origin=(0,0,0) >> #Looks reasonable, may be rotated? >> s.point_data.scalars=Image.ravel() >> >> For those reading along, I follow this with >> mlab.pipeline.volume(s) >> or >> self.scene.mlab.pipeline.volume(s) #in an object oriented script >> >> >> Do you know what's going on? This reminds me of how when I call >> skimage.io.imread(image_file), the 'x' coordinate of Image is usually what >> I would think of as the 'z' coordinate in other viewers like imagej. >> >> Thanks, >> Chris >> >> On Wed, Jul 29, 2015 at 12:59 AM, Gael Varoquaux < >> gael.varoqu...@normalesup.org> wrote: >> >>> Replace the creationg of "s" by instanciating an ImageData: >>> >>> http://docs.enthought.com/mayavi/mayavi/data.html#imagedata >>> >>> That should do it, >>> >>> G >>> >>> On Tue, Jul 28, 2015 at 06:02:07PM -0500, Christopher Snyder wrote: >>> > Hi there, >>> >>> > My usual routine involves >>> > ix,iy,iz=np.indices(Image) >>> > >>> s=mlab.pipeline.scalar_field(spacing[0]*ix,spacing[1]*iy,spacing[2]*iz,Image) >>> > mlab.pipeline(volume(s)) >>> >>> > However, I am strapped for memory. Actually forming the indices >>> ix,iy,iz is >>> > putting a burden on my code. Is there some workaround, perhaps through >>> the >>> > depths of vtk, that lets me specify this with just the scalar tuple >>> (1,1,2) ??? >>> > >>> >>> > Thanks in anticipation, >>> > Chris Snyder >>> >>> > >>> ------------------------------------------------------------------------------ >>> >>> > _______________________________________________ >>> > MayaVi-users mailing list >>> > MayaVi-users@lists.sourceforge.net >>> > https://lists.sourceforge.net/lists/listinfo/mayavi-users >>> >>> >>> -- >>> Gael Varoquaux >>> Researcher, INRIA Parietal >>> NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France >>> Phone: ++ 33-1-69-08-79-68 >>> http://gael-varoquaux.info >>> http://twitter.com/GaelVaroquaux >>> >> >> >
------------------------------------------------------------------------------
_______________________________________________ MayaVi-users mailing list MayaVi-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mayavi-users