<commit_before>/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/

#include "mitkGeometry2DDataVtkMapper3D.h"
#include "QmitkSelectableGLWidget.h"
#include "QLevelWindowWidget.h"
#include <vtkSTLReader.h>
#include <mitkSurfaceData.h>
#include <mitkColorProperty.h>
#include <mitkLevelWindowProperty.h>
#include <LevelWindow.h>
#include <mitkFloatProperty.h>
#include <qregexp.h>

mitk::FloatProperty::Pointer opacityprop=NULL;

void QmitkMainTemplate::fileNew()
{

}

void QmitkMainTemplate::fileOpen()
{
    QString fileName = QFileDialog::getOpenFileName(NULL,"DKFZ Pic (*.seq *.pic *.pic.gz *.seq.gz);;stl files (*.stl)");

    if ( !fileName.isNull() )
    {
        fileOpen(fileName.ascii());
        mitkMultiWidget->updateMitkWidgets();
    }
}

void QmitkMainTemplate::fileOpen( const char * fileName )
{
    mitk::DataTreeNode::Pointer node=NULL;
    if(strstr(fileName, ".stl")!=0)
    {
        std::cout << "loading " << fileName << " as stl ... " << std::endl;

        vtkSTLReader *stlreader = vtkSTLReader::New();
        stlreader->SetFileName(fileName);
        stlreader->Update();

        if(stlreader->GetOutput()!=NULL)
        {
            mitk::SurfaceData::Pointer surface = mitk::SurfaceData::New();
            surface->SetVtkPolyData(stlreader->GetOutput());
            //surface->Register(); //FIXME: das weakpointer-Problem! ...

            mitk::DataTreeIterator* it=tree->inorderIterator();

            node=mitk::DataTreeNode::New();
            node->SetData(surface);
            it->add(node);

            //FIXME: das folgende sollte berflssig sein. Problem ist aber, das es z.Z. noch keine Mglichkeit gibt festzustellen, wann der Baum zuletzt gendert wurde.
            //mitkMultiWidget->mitkWidget1->GetRenderer()->SetData(it);
            //mitkMultiWidget->mitkWidget2->GetRenderer()->SetData(it);
            //mitkMultiWidget->mitkWidget3->GetRenderer()->SetData(it);
            mitkMultiWidget->mitkWidget4->GetRenderer()->SetData(it);

            delete it;
        }
    }
    else
        if((strstr(fileName, ".pic")!=0) || (strstr(fileName, ".seq")!=0))
        {
            ipPicDescriptor *header=ipPicGetHeader(const_cast<char *>(fileName), NULL);
            if(header!=NULL)
            {
                mitk::PicFileReader::Pointer reader;

                reader=mitk::PicFileReader::New();
                std::cout << "loading " << fileName << " as pic ... " << std::endl;
                //            reader->Register(); //FIXME: das WeakPointer problem!

                reader->SetFileName(fileName);


                mitk::DataTreeIterator* it=tree->inorderIterator();

                node=mitk::DataTreeNode::New();
                node->SetData(reader->GetOutput());
                it->add(node); 

                initWidgets(node);

                //mitk::DataTreeNode::Pointer node2=mitk::DataTreeNode::New();
                //node2->SetData(mitkMultiWidget->mitkWidget3->GetRenderer()->GetWorldGeometry2DData());
                //it->add(node2);


                mitkMultiWidget->mitkWidget4->GetRenderer()->SetMapperID(2);
                mitkMultiWidget->mitkWidget4->GetRenderer()->SetData(it);
                mitkMultiWidget->mitkWidget4->GetRenderer()->GetDisplayGeometry()->Fit();
                // schrg
                //initWidget(it,
                //	   mitkMultiWidget->mitkWidget4,
                //	   Vector3f(0,0,0),
                //	   Vector3f(header->n[0],header->n[1],0),
                //	   Vector3f(0,0,header->n[2])
                //	   );
                //       ipPicFree(header);
                delete it;
            }
        }
        if(node != NULL)
        {

						mitk::LevelWindowProperty::Pointer levWinProp = new mitk::LevelWindowProperty();
						levWinProp->GetLevelWindow().SetRangeMin(-1024);
						levWinProp->GetLevelWindow().SetRangeMax(4096);
						levWinProp->GetLevelWindow().SetMin(-1024);
						levWinProp->GetLevelWindow().SetMax(4096);

						node->GetPropertyList()->SetProperty("levelwindow",levWinProp);

						connect(mitkMultiWidget->levelWindowWidget,SIGNAL(levelWindow(mitk::LevelWindow*)),this,SLOT(changeLevelWindow(mitk::LevelWindow*)) );

        }
}<commit_msg>added support for .ves file types<commit_after>/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/

#include "mitkGeometry2DDataVtkMapper3D.h"
#include "QmitkSelectableGLWidget.h"
#include "QLevelWindowWidget.h"
#include <vtkSTLReader.h>
#include <mitkSurfaceData.h>
#include <mitkColorProperty.h>
#include <mitkLevelWindowProperty.h>
#include <mitkVesselTreeFileReader.h>
#include <LevelWindow.h>
#include <mitkFloatProperty.h>
#include <qregexp.h>

mitk::FloatProperty::Pointer opacityprop=NULL;

void QmitkMainTemplate::fileNew()
{

}

void QmitkMainTemplate::fileOpen()
{
    QString fileName = QFileDialog::getOpenFileName(NULL,"DKFZ Pic (*.seq *.pic *.pic.gz *.seq.gz);;stl files (*.stl);;ves files (*.ves)");

    if ( !fileName.isNull() )
    {
        fileOpen(fileName.ascii());
        mitkMultiWidget->updateMitkWidgets();
    }
}

void QmitkMainTemplate::fileOpen( const char * fileName )
{
    mitk::DataTreeNode::Pointer node=NULL;
    if(strstr(fileName, ".stl")!=0)
    {
        std::cout << "loading " << fileName << " as stl ... " << std::endl;

        vtkSTLReader *stlreader = vtkSTLReader::New();
        stlreader->SetFileName(fileName);
        stlreader->Update();

        if(stlreader->GetOutput()!=NULL)
        {
            mitk::SurfaceData::Pointer surface = mitk::SurfaceData::New();
            surface->SetVtkPolyData(stlreader->GetOutput());
            //surface->Register(); //FIXME: das weakpointer-Problem! ...

            mitk::DataTreeIterator* it=tree->inorderIterator();

            node=mitk::DataTreeNode::New();
            node->SetData(surface);
            it->add(node);

            //FIXME: das folgende sollte berflssig sein. Problem ist aber, das es z.Z. noch keine Mglichkeit gibt festzustellen, wann der Baum zuletzt gendert wurde.
            //mitkMultiWidget->mitkWidget1->GetRenderer()->SetData(it);
            //mitkMultiWidget->mitkWidget2->GetRenderer()->SetData(it);
            //mitkMultiWidget->mitkWidget3->GetRenderer()->SetData(it);
            mitkMultiWidget->mitkWidget4->GetRenderer()->SetData(it);

            delete it;
        }
    }
    else
        if((strstr(fileName, ".pic")!=0) || (strstr(fileName, ".seq")!=0))
        {
            ipPicDescriptor *header=ipPicGetHeader(const_cast<char *>(fileName), NULL);
            if(header!=NULL)
            {
                mitk::PicFileReader::Pointer reader;

                reader=mitk::PicFileReader::New();
                std::cout << "loading " << fileName << " as pic ... " << std::endl;
                //            reader->Register(); //FIXME: das WeakPointer problem!

                reader->SetFileName(fileName);


                mitk::DataTreeIterator* it=tree->inorderIterator();

                node=mitk::DataTreeNode::New();
                node->SetData(reader->GetOutput());
                it->add(node); 

                initWidgets(node);

                //mitk::DataTreeNode::Pointer node2=mitk::DataTreeNode::New();
                //node2->SetData(mitkMultiWidget->mitkWidget3->GetRenderer()->GetWorldGeometry2DData());
                //it->add(node2);


                mitkMultiWidget->mitkWidget4->GetRenderer()->SetMapperID(2);
                mitkMultiWidget->mitkWidget4->GetRenderer()->SetData(it);
                mitkMultiWidget->mitkWidget4->GetRenderer()->GetDisplayGeometry()->Fit();
                // schrg
                //initWidget(it,
                //	   mitkMultiWidget->mitkWidget4,
                //	   Vector3f(0,0,0),
                //	   Vector3f(header->n[0],header->n[1],0),
                //	   Vector3f(0,0,header->n[2])
                //	   );
                //       ipPicFree(header);
                delete it;
            }
        }
        else if( strstr(fileName, ".ves")!=0 )
        {
            mitk::VesselTreeFileReader::Pointer reader = mitk::VesselTreeFileReader::New();
            std::cout << "loading " << fileName << " as ves ... " << std::endl;
            reader->SetFileName(fileName);          
            reader->Update();
            mitk::DataTreeIterator* it=tree->inorderIterator();

            node=mitk::DataTreeNode::New();
            node->SetData(reader->GetOutput());
            it->add(node); 

            initWidgets(node);
            delete it;
        }
        if(node != NULL)
        {

						mitk::LevelWindowProperty::Pointer levWinProp = new mitk::LevelWindowProperty();
						levWinProp->GetLevelWindow().SetRangeMin(-1024);
						levWinProp->GetLevelWindow().SetRangeMax(4096);
						levWinProp->GetLevelWindow().SetMin(-1024);
						levWinProp->GetLevelWindow().SetMax(4096);

						node->GetPropertyList()->SetProperty("levelwindow",levWinProp);

						connect(mitkMultiWidget->levelWindowWidget,SIGNAL(levelWindow(mitk::LevelWindow*)),this,SLOT(changeLevelWindow(mitk::LevelWindow*)) );

        }
}
{'fraction_non_alphanumeric': 0.17513839959738298, 'fraction_numerical': 0.009562154001006542, 'mean_word_length': 2.593490054249548, 'pattern_counts': {'":': 0, '<': 60, '<?xml version=': 0, '>': 134, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3219416', 'n_tokens_mistral': 3039, 'n_tokens_neox': 2839, 'n_words': 456}