gregvonkuster / galaxy-csg

Galaxy tools for Constructive Solid Geometry
MIT License
5 stars 2 forks source link

Error when selecting png file for texture #27

Closed pletzer closed 8 years ago

pletzer commented 8 years ago

@gregvonkuster Selecting a png file for texture does not work

I created a default box and uploaded the png file testbolt

Then I add texture to shape using a max edge length of 10 and I get the following error, which suggests that jpeg reader was used in place of the png reader.

--Alex

ERROR: In /var/lib/openshift/5611ccc02d52713b6000010c/app-root/data/source/vtklite/VTK-6.3.0/IO/Image/vtkJPEGReader.cxx, line 174 vtkJPEGReader (0x268d730): libjpeg could not read file: /var/lib/openshift/5611ccc02d52713b6000010c/app-root/data/source/galaxy/database/files/000/dataset_90.dat

ERROR: In /var/lib/openshift/5611ccc02d52713b6000010c/app-root/data/source/vtklite/VTK-6.3.0/IO/Image/vtkJPEGReader.cxx, line 357 vtkJPEGReader (0x268d730): libjpeg could not read file: /var/lib/openshift/5611ccc02d52713b6000010c/app-root/data/source/galaxy/database/files/000/dataset_90.dat

Traceback (most recent call last): File "/var/lib/openshift/5611ccc02d52713b6000010c/app-root/data/source/galaxy/tools/csg/icqsol_add_texture.py", line 38, in vtk_poly_data = shape_mgr.addTextureToVtkPolyData(vtk_poly_data, texture_file=args.input_texture, max_edge_length=max_edge_length) File "build/bdist.linux-x86_64/egg/icqsol/shapes/icqShapeManager.py", line 215, in addTextureToVtkPolyData TypeError: SetTuple argument 2: expected a sequence of 3 values, got 1 values

gregvonkuster commented 8 years ago

@pletzer there is a mess of code that has to create a temporary file with a specific extension because the ShapeManager.addTextureToVtkPolyData() function will not accept an optional image format. The code would be so much simpler if you would agree to add format=None to the method signature. Then all of this complexity could be eliminated.

pletzer commented 8 years ago

@gregvonkuster I added the keyword texture_file_format to

def addTextureToVtkPolyData(self, vtk_poly_data,
                            texture_file,
                            max_edge_length=float('inf'),
                            texture_file_format=''):

in ShapeManager. If texture_file_format is not specified then the format will be inferred from the suffix.

gregvonkuster commented 8 years ago

@pletzer I've simplified the icqsol_add_texture tool to pass the texture_file_format parameter to ShapeManager.addTextureToVtkPolyData. But even without that change, I was not seeing this behavior. I have been uploading png files and applying them as texture for a while now. Make sure you are using the latest version of the tool.

pletzer commented 8 years ago

Fixed.