[vtkusers] vtkNIFTIImageReader.h: No such file or directory
David Gobbi
david.gobbi at gmail.com
Tue May 26 07:47:06 EDT 2015
Use the GetQFormMatrix() method of the reader to get the 4x4 matrix that
has the orientation and offset. You can apply this matrix to the hull
before you save it. Here's some example code (in python):
transform = vtkTransform()
transform.SetMatrix(reader.GetQFormMatrix())
tfilter = vtkTransformPolyDataFilter()
tfilter.SetTransform(transform)
tfilter.SetInputConnection( < the hull data > )
tfilter.Update()
Then save the output of the "tfilter" into your vtp file.
- David
On Tue, May 26, 2015 at 5:29 AM, Francisco Lopez de la Franca <
franciscolopezdelafranca at gmail.com> wrote:
> Hi again.
> I've already got the convex hull of my Nifti image, and you were right
> regarding the output image file. I'm saving in VTP format.
> I have another question.
> When I read the Nifti image, I also store its spacing, origin and
> dimension.
> When displaying the VTP file in 3D Slicer, the convex hull is shifted
> compared with the original image. How can I do to preserve the original
> origin and dimension? Neither the vtkImageMarchingCubes nor vtkHull contain
> the suited methods.
> I hope the question is clear and makes sense.
> Thanks a lot.
> MBR.
> /Francisco
>
>
> 2015-05-25 14:48 GMT+02:00 David Gobbi <david.gobbi at gmail.com>:
>
>> Hi Francisco,
>>
>> The vtkHull and vtkDelaunay3D classes require vtkPolyData as input. I
>> suspect that you need vtkImageMarchingCubes or vtkContourFilter.
>>
>> However, the output of these filters cannot be written to a NIFTI file.
>> In fact, I'm a bit confused when you say "write a convex hull to a NIFTI
>> file". A convex hull is a geometrical surface (e.g. made of polygons), but
>> NIFTI is an image file format.
>>
>> - David
>>
>> On Mon, May 25, 2015 at 6:35 AM, Francisco Lopez de la Franca <
>> franciscolopezdelafranca at gmail.com> wrote:
>>
>>> Hi.
>>> Thanks a lot. I've just downloaded VTK 6.2.0 and I've realised that
>>> there it is what I need.
>>> But, I take advantage of this moment to tell about another problem.
>>>
>>> I read a NIFTI file (abc.nii) through vtkNIFTIImageReader. Its output is
>>> passed to either vtkHull or vtkDelaunay3D in order to get the convex hull
>>> of the objects in the Nifti image.
>>>
>>> And, in the end, I write their result with vtkNIFTIImageWriter.
>>>
>>> The compilation goes right, but the execution (on a Windows system) does
>>> not produce anything and I hardly see a "command prompt" window flashing
>>> only once, but I am unable to read its content.
>>>
>>> I think there must be some incompatibility between the output of
>>> vtkNifitiImageReader and the input to vtkHull or vtkDelaunay3D, or
>>> something similar.
>>>
>>> Any suggestion on how to read a NIFTI file and get its convex hull and
>>> then write it to another Nifti file.
>>>
>>> Thank you very much.
>>> /Francisco
>>>
>>> 2015-05-25 14:25 GMT+02:00 David Gobbi <david.gobbi at gmail.com>:
>>>
>>>> Hi Francisco,
>>>>
>>>> The vtkNIFTIImageReader did not appear until VTK 6.2.
>>>> There are two options that I can recommend:
>>>>
>>>> 1) Use the VTK git master, which has the most recent update to the
>>>> NIFTI reader (the vtkNIFTIImageReader in VTK 6.2 gives the wrong sform
>>>> offset in some situations, this is fixed in git master).
>>>>
>>>> 2) If you want to keep the VTK you have, then you can get the NIFTI
>>>> reader separately by building the vtk-dicom package:
>>>> https://github.com/dgobbi/vtk-dicom (the class is called
>>>> "vtkNIFTIReader" in vtk-dicom, but is otherwise identical to the one in the
>>>> VTK git master branch).
>>>>
>>>> Cheers,
>>>> - David
>>>>
>>>>
>>>>
>>>> On Mon, May 25, 2015 at 1:54 AM, Francisco Lopez de la Franca <
>>>> franciscolopezdelafranca at gmail.com> wrote:
>>>>
>>>>> Hi everybody.
>>>>> I'd like to read a NIFTI image from VTK.
>>>>> I downloaded and compiled VTK 6.1.0, but when I include the
>>>>> vtkNIFTIImageReader header file, the compilation gives the error "No such
>>>>> file or directory".
>>>>> I've searched for the header file into the VTK directory and it is
>>>>> true, there is no such a file.
>>>>>
>>>>> I've tested with vtkImageReader2 and compilation goes fine, but the
>>>>> NIFTI file read does not seem to go well.
>>>>>
>>>>> Does anybody know what the problem could be?
>>>>>
>>>>> Thanks a lot.
>>>>> My best regards.
>>>>> /Francisco
>>>>>
>>>>> P.D.: My CMakeLists.txt contains the next lines:
>>>>>
>>>>> cmake_minimum_required(VERSION 2.8)
>>>>>
>>>>> project(CV_TFM_CONVEX_HULL)
>>>>>
>>>>> # Find VTK.
>>>>> find_package(VTK REQUIRED)
>>>>> include(${VTK_USE_FILE})
>>>>>
>>>>> set(CV_TFM_CONVEX_HULL_SRC CV_TFM_ConvexHull.cxx)
>>>>>
>>>>> add_executable(CV_TFM_CONVEX_HULL ${CV_TFM_CONVEX_HULL_SRC})
>>>>>
>>>>> target_link_libraries(CV_TFM_CONVEX_HULL ${VTK_LIBRARIES})
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150526/b635f0d8/attachment.html>
More information about the vtkusers
mailing list