[Insight-users] Help me out!!!
Luis Ibanez
luis.ibanez at kitware.com
Sun Jun 13 19:46:57 EDT 2004
Hi Krishna,
1) ITK have classes for reading the entire set of DICOM
files. Please look at the example:
Insight/Examples/IO/
DicomSeriesReadImageWrite.cxx
2) Qt is a GUI library, you will not find functionalities
for reading DICOM files there. However you will find
classes for displaying images.
For a demo application using a Qt GUI for displaying ITK
images you can look at
InsightApplications/Auxiliary/QtImageViewer
You could simply modify this application by integrating
in it the code of the example in (1). In that way you
will have a (Qt+ITK) application capable of reading
DICOM series and displaying them slice by slice.
--
Before you go too far... you are *strongly* encouraged
to read the first five sessions of the Tutorials
http://www.itk.org/HTML/Tutorials.htm
and the first two chapters of the software guide
http://www.itk.org/ItkSoftwareGuide.pdf
That will save you a lot of time once you start
writing code. In particular you must get familiar
with the data pipeline architecture used in ITK.
Regards,
Luis
---------------------------
krishna kanth dodda wrote:
> Hai ,
> I am using ITK and I have small problem in reading the DICOM file
> set. First I want to know wether there is any in built function in
> either Itk or Qt for reading the whole set of DICOM files and displaying
> one file after the other.
>
> what I have done is intially i have selected one file then the image
> was loaded ,the next thing i have done is i have implemented two buttons
> one previous and one Next, file loading but when i click these buttons I
> am getting a message that the loading image was sucessfull , But the
> Image is not getting updated.
>
> I am very new to Itk so please some body help me out .
> the code was already exists in Itk applications and i have made small
> changes and the changes are shown below .
>
> the code in Qtslicer.cxx
> (it is for the process to be done when clicked on "previous" button the
> files are named as "0001.dcm"..........."0035.dcm" ......."0120.dcm".)
> void QtSlicer::PreImage()
> {
>
> QString tmp=leImage->text();
> string temp = tmp.latin1();
> string k(temp,0,temp.size()-8);
> int i=sBimageno->value();
> i=i-1;
> //QtSlicer mGUi( 0, 0, TRUE );
>
>
>
> ReaderType::Pointer reader1 = ReaderType::New();
> char num[4];
>
> if(i>=1 && i<10)
> {
>
> if (i<=1) pBprevious->setProperty("enabled",QVariant(false));
> _itoa(i,num,10);
> k+="000";
> k+=num;
> k+=".dcm";
> }
> else if(i<100)
> {
> _itoa(i,num,10);
> k+="00";
> k+=num;
> k+=".dcm";
> }
> else if(i<1000)
> {
> _itoa(i,num,10);
> k+="0";
> k+=num;
> k+=".dcm";
> }
>
> r eader1->SetFileName( k.c_str());
> std::cout << "loading image " << k<<" ... ";
>
> reader1->Update();
>
> std::cout << "Done!" << std::endl;
> QtSlicer::SetInputImage( reader1->GetOutput() );
> ImageType::Pointer Image = reader1->GetOutput();
> sBimageno->setValue(i);
> }
>
>
> the code in QtslicerTest.cxx
>
> int main( int argc, char* argv[] )
> {
> string QtoC;
> QApplication myApp( argc, argv );
> QtSlicer m_GUI( 0, 0, TRUE );
> myApp.setMainWidget(&m_GUI);
> m_GUI.setCaption( "Insight Qt Slicer" );
> myApp.setStyle( new QPlatinumStyle );
> QPalette p( QColor( 239, 239, 239 ) );
> myApp.setPalette( p, TRUE );
> typedef double PixelType;
> typedef itk::Image<PixelType, 3> ImageType;
> typedef itk::ImageFileReader<ImageType> ReaderType;
> ReaderType::Pointer reader = ReaderType::New();
>
> QString s = QFileDialog::getExistingDirectory("/home",0,"get existing
> directory","Choose a directory",TRUE );
> QtoC=s.latin1();
> QtoC=QtoC+"/0024.dcm";
> s=QtoC;
> m_GUI.leImage->setText(s);
> reader->SetFileName( QtoC.c_str());
> std::cout << "loading image " << QtoC.c_str() << " ... ";
> try
> {
> reader->Update();
> }
> catch (itk::ExceptionObject & e)
> {
> std::cerr << "Exception in file reader " << std::endl;
> std::cerr << e << std::endl;
> return EXIT_FAILURE;
> }
>
> std::cout << "Done!" << std::endl;
> m_GUI.SetInputImage( reader->GetOutput() );
>
> try
> {
> m_GUI.exec();
> }
> catch (itk::ExceptionObject & e)
> {
> std::cerr << "Exception during GUI execution" << std::endl;
> std::cerr << e << ; std::endl;
> return EXIT_FAILURE;
> }
>
> return 0;
> }
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list