[Insight-users] Problems using ITK under linux

Luis Ibanez luis.ibanez at kitware.com
Wed Jan 20 14:48:51 EST 2010


Hi Maximilien,

We use ITK regularly in Linux,
so it is quite surprising to hear that
you are experiencing these problems.

--

The error that you are getting:

 Description: itk::ERROR: Image(0x89fd360): Bad direction, determinant
> is 0. Direction is 0 0 0
> 0 1 0
> 0 0 0


Indicates that you have a real problem
in the image that you are loading.


Please do the following:

A)  In Linux, run the ITK program:

       DicomImageReadPrintTags

     That should be build if you turn
      EXAMPLES   ON in your CMake
      configuration.

      Pass as argument to it, any of
      the DICOM slices of our series,

      and grep for the value of

      "Image Orientation"

      with a command such as:

./DicomImageReadPrintTags  003.dcm | grep "Image Orientation"

       the output should be something like:

(0020|0037) Image Orientation (Patient) =
0.000000\1.000000\0.000000\0.000000\0.000000\-1.000000

       but,... I'm guessing that in the case of your images
       one of these two direction cosines is all zeros.

       Please do this and post to the list the values
       that you find.


2)   Just to cross check, you could also look at the
       Image Direction tags in Windows, by using
       MRIConvert:

        http://lcni.uoregon.edu/~jolinda/MRIConvert/




  Please post your findings to the list,


         Thanks


               Luis


------------------------------------------------
On Tue, Jan 19, 2010 at 3:56 AM, Maximilien Renard <iixamaxii at gmail.com> wrote:
> Dear ITK users,
>
> I've been using ITK in one of my project for a while. As long as I
> remember, I've been stuck with a problem while trying to open DICOM
> images generated by a CT-Scan.
>
> I've always used ITK-3.8 both under linux ubuntu and windows. While
> everything would work fine under Windows, something would always go
> wrong under linux. I could not get the spacings of my images (in none
> of the directions). It was bothering but for developpment purpose, I
> could cope with it.
>
> I've tried to update to ITK-3.16 today. The result is even worse.
> While it still works under Windows, I cannot even open the images
> anymore under linux. Instead I have these error messages popping up in
> the konsole.
>
> Starting /home/ixm/Documents/Code/C++/LightCTScannerAnalysis/LightCTScannerAnalysis...
>
> itk::ExceptionObject (0x89fd728)
>
> Location: "void
> itk::ImageBase<VImageDimension>::ComputeIndexToPhysicalPointMatrices()
> [with unsigned int VImageDimension = 3u]"
>
> File: /usr/local/include/InsightToolkit/Common/itkImageBase.txx
>
> Line: 191
>
> Description: itk::ERROR: Image(0x89fd360): Bad direction, determinant
> is 0. Direction is 0 0 0
>
> 0 1 0
>
> 0 0 0
>
> QPainter::begin: Cannot paint on a null pixmap
>
> QPainter::end: Painter not active, aborted
>
> itk::ExceptionObject (0x88849a8)
>
> Location: "void
> itk::ImageBase<VImageDimension>::ComputeIndexToPhysicalPointMatrices()
> [with unsigned int VImageDimension = 3u]"
>
> File: /usr/local/include/InsightToolkit/Common/itkImageBase.txx
>
> Line: 191
>
> Description: itk::ERROR: Image(0x87c7878): Bad direction, determinant
> is 0. Direction is -0 0 0
>
> 0 1 0
>
> 0 0 -0
>
> QPainter::begin: Cannot paint on a null pixmap
>
> QPainter::end: Painter not active, aborted
>
> The program has unexpectedly finished.
>
> /home/ixm/Documents/Code/C++/LightCTScannerAnalysis/LightCTScannerAnalysis
> exited with code 0
>
> Some time ago, I've had a little chat with Bill Lorensen who told me
> my images weren't series or so. Well, these images have been given to
> me by a belgian orthopaedics clinic and they were able to use them
> (like me under windows) so I guess, it's rather a platform dependend
> issue (maybe the problem is that it should not even work on Windows
> :P).
>
> So my question is, what could cause that ? What would need to be able
> to help me (even just a little ?). Anyway, I'll paste my opening code
> below.
>
> Thank you very much for your help.
>
> Best regards,
>
> Maximilien Renard
>
> ULB - MA1 Ingénieur Civil Biomédical
> maxrenard at ulb.ac.be
> +32 476 63 68 92
>
> P.S. Here it is :
>
> CMainView * CVolumeDataReadWrite::OpenFiles(QString FilePath) {
>        QString Dir;
>        QFileInfo FileInfo(FilePath);
>        Dir = FileInfo.absolutePath();
>
>        typedef itk::ImageSeriesReader<ITK3DImageType> ReaderType;
>        ReaderType::Pointer reader = ReaderType::New();
>
>        typedef itk::GDCMImageIO ImageIOType;
>        ImageIOType::Pointer dicomIO = ImageIOType::New();
>
>        reader->SetImageIO(dicomIO);
>
>        typedef itk::GDCMSeriesFileNames NamesGeneratorType;
>        NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();
>
>        nameGenerator->SetUseSeriesDetails(true);
>
>        nameGenerator->SetDirectory(Dir.toUtf8().constData());
>
>        typedef std::vector<std::string> SeriesIdContainer;
>
>        const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
>
>        QStringList FileList;
>
>        SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();
>        SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();
>        while(seriesItr != seriesEnd) {
>                QString TempName = seriesItr->c_str();
>                TempName += " ("+
> QString::number(nameGenerator->GetFileNames(seriesItr->c_str()).size())
> +")";
>
>                FileList << TempName;
>                seriesItr++;
>        }
>
>        CDialogSeries * dlg = new CDialogSeries(FileList);
>
>        int SelectedSeries = dlg->exec();
>
>        //qDebug() << SelectedSeries;
>
>        if(SelectedSeries < 0)
>                return NULL;
>
>        unsigned int MainViewID;
>        CMainView * CurMainView = NULL;
>
>        if(GetWindow()->GetNbMainViews() > 0) {
>                CDialogMainViewAsParent * DialogMainViewAsParent = new
> CDialogMainViewAsParent(GetWindow()->GetMainViewsNames(), "DICOM");
>
>                MainViewID = DialogMainViewAsParent->exec();
>
>                if(MainViewID < GetWindow()->GetNbMainViews()) {
>                        CurMainView = GetWindow()->GetMainView(MainViewID);
>                } else {
>                        CurMainView = NULL;
>                }
>        }
>
>        if(CurMainView == NULL) {
>                MainViewID = GetWindow()->AddNewMainView();
>                CurMainView = GetWindow()->GetMainView(MainViewID);
>        }
>
>        typedef std::vector<std::string> FileNamesContainer;
>        FileNamesContainer fileNames;
>
>        QString Ser = FileList.at(SelectedSeries);
>        int Index = Ser.indexOf(' ');
>        Ser = Ser.left(Index);
>
>        fileNames = nameGenerator->GetFileNames(Ser.toUtf8().constData());
>
>        reader->SetFileNames(fileNames);
>
>        try {
>                reader->Update();
>        }
>        catch(itk::ExceptionObject &ex) {
>                std::cout << ex << std::endl;
>        }
>
>        CVolumeData * pVD = new CVolumeData(CurMainView);
>
>        ITK3DImageType::SpacingType spacings = reader->GetOutput()->GetSpacing();
>
>        //qDebug() << spacings[0] << spacings[1] << spacings[2];
>
>        pVD->SetITK3DImage(reader->GetOutput());
>
>        unsigned int DimX, DimY, DimZ;
>        pVD->GetDimensions(DimX, DimY, DimZ);
>
>        //qDebug() << DimX << DimY << DimZ;
>
>        float SpacingX, SpacingY, SpacingZ;
>        pVD->GetSpacings(SpacingX, SpacingY, SpacingZ);
>
>        /*if(Dir.contains(QString("DICOM-PATIENT-1"), Qt::CaseInsensitive))
>                pVD->SetSpacings(0.15, 0.15, 0.60);
>        else if(Dir.contains(QString("DICOM-PATIENT-2"), Qt::CaseInsensitive))
>                pVD->SetSpacings(0.15, 0.15, 0.33);*/
>
>        //qDebug() << SpacingX << SpacingY << SpacingZ;
>
>        //qDebug() << dicomIO->GetSpacing(0) << dicomIO->GetSpacing(1) <<
> dicomIO->GetSpacing(2);
>
>        double RescaleIntercept, RescaleSlope;
>        RescaleIntercept = dicomIO->GetRescaleIntercept();
>        RescaleSlope = dicomIO->GetRescaleSlope();
>        pVD->SetRescaleInformation(RescaleSlope, RescaleIntercept);
>
>        unsigned short *ptr;
>        float Value;
>        ptr = pVD->GetITK3DImage()->GetBufferPointer();
>
>
>        for (unsigned int i = 0; i < DimX * DimY * DimZ; i++) {
>                Value = (signed short)(ptr[i]);
>                Value = (Value - RescaleIntercept) / RescaleSlope;
>                        ptr[i] = (unsigned short)Value;
>        }
>
>        CurMainView->SetVolumeData(pVD);
>
>        return CurMainView;
> }
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list