Discussion:
[vtkusers] Can't read image with VTK
Franks
2018-10-28 06:25:20 UTC
Permalink
Hi,
I have a question when I use VTK with CLion. I'm using VTK 8.1 in c++ build
with cmake3.12. When I read image by using class *"vtkMetaImageReader"(other
class inheriting "vtkImageReader2" have the same problem*), the program
crash with "*Process finished with exit code -1073741515
(0xC0000135)*"(display in clion). But class "vtkStructuredPointsReader" can
run correctly. I think it may lack some libraries related with image. Now, I
have no idea with this problem.

CMakeLists.txt

/cmake_minimum_required(VERSION 3.12)
project(vtk_demo)

set(CMAKE_CXX_STANDARD 14)

aux_source_directory(src SOURCE_FILES)
set(RES_FILES res/brain.mhd res/brain.raw)
include_directories(include)

#vtk
set(VTK_DIR G:\\VTK)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})

add_executable(vtk_demo ${SOURCE_FILES} ${RES_FILES})
target_link_libraries(vtk_demo ${VTK_LIBRARIES})/



main.cpp

/#include <vtkSmartPointer.h>
#include <vtkImageViewer2.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkMetaImageReader.h>


int main(int argc, char* argv[])
{

auto reader =
vtkSmartPointer<vtkMetaImageReader>::New();
reader->SetFileName("../res/brain.mhd");
reader->Update();

auto imageViewer =
vtkSmartPointer<vtkImageViewer2>::New();
imageViewer->SetInputConnection(reader->GetOutputPort());

auto renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
imageViewer->SetupInteractor(renderWindowInteractor);

imageViewer->SetColorLevel(500);
imageViewer->SetColorWindow(2000);
imageViewer->SetSlice(40);
imageViewer->SetSliceOrientationToXY();
imageViewer->Render();

imageViewer->GetRenderer()->SetBackground(1.0, 1.0, 1.0);
imageViewer->SetSize(640, 480);
imageViewer->GetRenderWindow()->SetWindowName("DisplayImageExample");

renderWindowInteractor->Start();

return 0;
}
/
Thank you very much in advance,
Best regards,
Franks



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Franks
2018-10-28 12:02:23 UTC
Permalink
I have solved this problem. Add your tiff path(tiff/bin) to environmental
variable and then vtk will work fine.



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

Continue reading on narkive:
Search results for '[vtkusers] Can't read image with VTK' (Questions and Answers)
31
replies
Why do people blame Islam for terrorism?
started 2008-07-26 12:40:20 UTC
religion & spirituality
Loading...