[Insight-users] Unexplained file extensions in ITK
Luis Ibanez
luis.ibanez at kitware.com
Fri Apr 11 18:29:28 EDT 2008
Hi Reuben,
Thanks for the update on your progress.
A couple of comments:
1) To verify that your MetaImage headers are correct,
please try:
ParaView www.paraview.org
Slicer http://www.na-mic.org/Slicer/Download/Snapshots/
You should also be able to read the Nifti image files with
Slicer (the files with extension .nii).
2) It is normal that you see only one slice in your
VTK visualization, since you are using the vtkImageActor.
You would have to add interactions in order to allow the
user to change the Slice number of the image actor, so
you can slide through the image.
Another nice option is the vtkImagePlaneWidget.
Please try the examples in:
InsightApplications/Auxiliary/vtk
itkReadITKImage3DSegmentShowVTK.cxx*
itkReadITKImageSegmentShowVTK.cxx*
itkReadITKImageShowSplineVTK.cxx*
itkReadITKImageShowVTK.cxx*
Regards,
Luis
--------------------
Reuben Kraft wrote:
> Hi Luis,
>
> Thanks for the reply. I have made no progress on reading those files
> *t1, *t2, *pd files. However, yesterday I moved on to reading *.raw
> files (obtained from itk website) with the appropriate *.mhd file and
> had moderate sucess. Using the *.mhd file, I specfiy a series of *.raw
> 2D slices to read. It seems I am reading them fine, however when I try
> and view them in VTK I can only see one slice (I think...I mean I don't
> see a volume just one plane).
>
> I have also been in contact with Visible Dave (
> http://dave.thehorners.com/content/view/72/68/ ) who graciously gave me
> his MRI scans in *nii format. Using itk-SNAP I was able to view the
> nifiti format succesffully and went on to try reading them through my
> own itk c++ file. Once again, I can only see one slice. Any ideas
> about my 3D view problems? Also, any suggestions or locations for
> further info about reading *.nii files would be great.
>
> Pasted below is my code for viewing a 3d representation of 2d *.raw
> slices I mentioned in the first paragraph.
>
> Thanks for your valuable time.
> Reuben
>
> int main() {
>
> typedef itk::Image<unsigned char, 3> ImageType;
> // Declare a reader
> typedef itk::ImageFileReader< ImageType > VolumeReaderType;
> VolumeReaderType::Pointer reader = VolumeReaderType::New();
>
> // Set the name of the file to read
> reader->SetFileName( "VisibleWomanHead.mhd" );
>
> // See if the file can be read - "try" otherwise program will
> // mysteriously exit on failure in the Object factory
> try{reader->Update();}
> catch( ... ){
> std::cout << "Problems reading file format" << std::endl;
> return EXIT_FAILURE;
> }
>
> typedef itk::ImageToVTKImageFilter< ImageType> ConnectorType;
> ConnectorType::Pointer connector = ConnectorType::New();
> connector->SetInput( reader->GetOutput() );
>
> // Add image to an vtk actor
> vtkImageActor * imageActor = vtkImageActor::New();
> imageActor->SetInput(connector->GetOutput());
>
> //Add that actor to the renderer
> vtkRenderer *ren1 = vtkRenderer::New();
> ren1->AddActor(imageActor);
> ren1->SetBackground(0.1, 0.2, 0.4);
>
> //Create a render window
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(ren1);
> renWin->SetSize(600, 600);
>
> //Create an interactor and associate it to the render window
> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
>
> //Define the interacting style
> vtkInteractorStyleTrackballCamera *style =
> vtkInteractorStyleTrackballCamera::New();
> iren->SetInteractorStyle(style);
>
> //Start to interact
> iren->Initialize();
> iren->Start();
>
> }
>
>
> On Wed, Apr 9, 2008 at 4:54 PM, Luis Ibanez <luis.ibanez at kitware.com
> <mailto:luis.ibanez at kitware.com>> wrote:
>
>
> Hi Reuben,
>
>
> Welcome to ITK !!
>
>
> I'm not aware of any fileformat that uses the extensions:
>
> ".t1"
> ".t2"
> ".pb"
>
> It is tempting to especulate that they simply refer to
> MRI modalites "T1", "T2" and "Proton Density".
>
>
>
> If the files actually contain DICOM files, then you
> should be able to read them directly with the ITK
> ImageFileReader, since the DICOM reader doesn't expect
> any file name extension in particular.
>
> I would suggest you try reading one of the 2D slices
> with the example:
>
> Insight/Examples/IO/ImageReadWrite.cxx
>
> with a command line similar to:
>
> ImageReadWrite input.t1 output.mhd
>
>
> and then visualize the output with
>
> Slicer (www.slicer.org <http://www.slicer.org>)
> ParaView (www.paraview.org <http://www.paraview.org>)
>
>
> Actually, you may be able to read the .t1, .t2, .pd
> files directly with Slicer, since Slicer uses the
> ITK readers.
>
>
> Also, you could use the Example:
>
> DicomImageReadPrintTags.cxx
>
> just to check if there are actual DICOM tags in
> these files.
>
>
>
> Please let us know if you find any problem,
>
>
> Thanks
>
>
> Luis
>
>
> --------------------
>
> Reuben Kraft wrote:
>
> Hello Luis,
>
> I am a new user to ITK. I submitted a request to the users group
> but have not heard anything back, My background is in finite
> element modeling and I am interested in contributing some
> features into ITK in the future. Right now, I am trying to get
> up to speed with my first goal of reading MRI information
> obtained from the Visible Human Project.
> I received files from a colleague with little description as to
> what format they are in. They have file extensions *.pd. *.t1,
> and *.t2. From what I am able to find online, it seems they
> may be DICOM format, but I am not sure.
> I have not found anything in the insight users forum about
> reading files with this extension, and I have been trying some
> things on my own with no success. ITK does not recognize this
> extension and prefers another. Do I need to change the file
> extension? If so, to what? Any suggestions on further reading
> I can do to understand how to get these image slices into ITK?
>
> A short comment about these file extensions may be useful in the
> ITK user's guide in the future. Thanks for your time, and sorry
> for the newbie question.
>
> Respectfully,
> Reuben Kraft, Ph.D.
>
>
More information about the Insight-users
mailing list