I have compiled CLI module with slicer to use it within slicer.
The module input is vtk volume geometry (contains points, elements, stresses) then it calculates the average stresses on the surface to get a vtp surface geometry (output).
When I used the module in slicer I got this error that slicer failed to read input surface.
Kindly note the log file, Can someone help me solve this issue, please?
I have compiled CLI module with slicer to use it within slicer. (all succeeded no failure)
The module input is vtk volume geometry (contains points, elements, stresses) then it calculates the average stresses on the surface to get a vtp surface geometry (output).
When I used the module in slicer I got this error that slicer failed to read input surface. it seems the module couldn’t find vtk directory although it is included in cmake.txt.
Kindly note the log file, cmake module and cmake extension.
Can someone help me solve this issue, please?
cmake_minimum_required(VERSION 2.8.9)
project(AAA_AverageStress)
#-----------------------------------------------------------------------------
# Extension meta-information
set(EXTENSION_HOMEPAGE "http://www.example.com/Slicer/Extensions/AAA_AverageStress")
set(EXTENSION_CATEGORY "AAA")
set(EXTENSION_CONTRIBUTORS "Grand Joldes (The University of Western Australia, ISML)")
set(EXTENSION_DESCRIPTION "This is an example of a simple extension")
set(EXTENSION_ICONURL "http://www.example.com/Slicer/Extensions/AAA_AverageStress.png")
set(EXTENSION_SCREENSHOTURLS "http://www.example.com/Slicer/Extensions/AAA_AverageStress/Screenshots/1.png")
#-----------------------------------------------------------------------------
# Extension dependencies
find_package(Slicer REQUIRED)
include(${Slicer_USE_FILE})
#-----------------------------------------------------------------------------
# Extension modules
add_subdirectory(AAA_AverageStress)
## NEXT_MODULE
#-----------------------------------------------------------------------------
include(${Slicer_EXTENSION_CPACK})
If you use the latest master version then you need to enable “Preserve CLI module data files” option in developer section in application settings to keep the CLI input/output files after execution.
Unfortunately, this didn’t solve the issue, the only thing that it saved this vtp file in the slicer directory “JHBC_vtkMRMLModelNodeE.vtp” but couldn’t read it,
Do you think older version of slicer would solve this issue (i.e. slicer 4.10.2) ?
stress.vtk is my input file, it has node coordinates, elements (cells), and stresses.
CCI_vtkMRMLModelNodeE.vtp is the created vtp file it contains only the node coordinates and stresses (of stress.vtk).
The vtp file that the CLI module created is valid, but it is just a point cloud. You need to copy cells from the input data set (triangles, polygons, vertices, …). Alternatively, you can just leave it as a point cloud but then in Slicer you need to apply a glyph filter to create some displayable geometry, for example using a glyph filter:
inputPointCloud = getNode('CCI_vtkMRMLModelNodeE')
glypher=vtk.vtkGlyph3D()
glypher.SetInputConnection(inputPointCloud.GetPolyDataConnection())
model = slicer.modules.models.logic().AddModel(glypher.GetOutputPort())
model.GetDisplayNode().SetScalarVisibility(True)
model.GetDisplayNode().SetActiveScalarName("S:Mises")
Thankyou very much Andreas for this solution and your valuable time,
but what I am interested in is that my extension should take the input file (stress.vtk) and calculate the average stresses through thickness and write the output file which is the outer surface of this geometry only (surface without thickness with the averaged stress values).
After trying a lot with slicer platform, I tried to run this extension using command line, it asks about the following files: (ITKFactoryRegistration.dll) (vtkIO-8.2.dll) (vtkFilters-8.2.dll) (vtkCommon-8.2.dll), I found the vtk.dll files and copied them from slicer built folder to my built extension folder but I couldn’t find ITKFactoryRegistration.dll anywhere.
I think the extension is not able to call some required files. Although it was compiled with old version of slicer (I think in 2014) and working perfectly.
This extension is created by Prof. Grand Joldes and used within BioPARR software for aneurysm stress calculations, it is not available on github.
I just copied the required vtk.dll files (generated from slicer building) to the extension folder and run it through the command line not through slicer.
In general, DLL files are not portable across different software versions. In some cases they might accidentally work, but in general, if there is a DLL version mismatch then the application is expected to crash.