QmitkTensorReconstructionView. More...
#include <QmitkTbssView.h>


Public Member Functions | |
| QmitkTbssView () | |
| virtual | ~QmitkTbssView () |
| virtual void | CreateQtPartControl (QWidget *parent) |
| virtual void | CreateConnections () |
| Creation of the connections of main and control widget. | |
| virtual void | Activated () |
| Called when the functionality is activated. | |
| virtual void | Deactivated () |
| virtual void | StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) |
| virtual void | StdMultiWidgetNotAvailable () |
Static Public Attributes | |
| static const std::string | VIEW_ID = "org.mitk.views.tbss" |
| static const int | nrconvkernels |
Protected Slots | |
| void | OutputValues () |
| void | OutputUnconnectedPointValues () |
Protected Member Functions | |
| void | SetDefaultNodeProperties (mitk::DataNode::Pointer node, std::string name) |
| void | SkeletonSelected (mitk::DataNode::Pointer skeletonNode) |
| void | RoiSelected (mitk::DataNode::Pointer roiNode) |
| std::vector < RoiImageType::IndexType > | SortPoints (RoiImageType::Pointer roi) |
| bool | PointVisited (std::vector< RoiImageType::IndexType > points, RoiImageType::IndexType point) |
| RoiImageType::IndexType | FindNextPoint (std::vector< RoiImageType::IndexType > pointsVisited, RoiImageType::IndexType currentPoint, RoiImageType::Pointer roi, bool &ready) |
Protected Attributes | |
| Ui::QmitkTbssViewControls * | m_Controls |
| QmitkStdMultiWidget * | m_MultiWidget |
| berry::ISelectionListener::Pointer | m_SelListener |
| berry::IStructuredSelection::ConstPointer | m_CurrentSelection |
| bool | m_IsInitialized |
| mitk::DataNode::Pointer | m_SkeletonNode |
| mitk::DataNode::Pointer | m_RoiNode |
Friends | |
| struct | TbSelListener |
QmitkTensorReconstructionView.
Document your class here.
Definition at line 52 of file QmitkTbssView.h.
| QmitkTbssView::QmitkTbssView | ( | ) |
Definition at line 183 of file QmitkTbssView.cpp.
: QmitkFunctionality(), m_Controls(NULL), m_MultiWidget(NULL) { }
| QmitkTbssView::~QmitkTbssView | ( | ) | [virtual] |
Definition at line 190 of file QmitkTbssView.cpp.
References berry::WorkbenchPart::GetSite(), and m_SelListener.
{
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->RemovePostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener);
}
| void QmitkTbssView::Activated | ( | ) | [virtual] |
Called when the functionality is activated.
Reimplemented from QmitkFunctionality.
Definition at line 238 of file QmitkTbssView.cpp.
| void QmitkTbssView::CreateConnections | ( | ) | [virtual] |
Creation of the connections of main and control widget.
Definition at line 229 of file QmitkTbssView.cpp.
References m_Controls, OutputUnconnectedPointValues(), and OutputValues().
Referenced by CreateQtPartControl().
{
if ( m_Controls )
{
connect( (QObject*)(m_Controls->m_OutputValues), SIGNAL(clicked()), this, SLOT(OutputValues()) );
connect( (QObject*)(m_Controls->m_OutputPoints), SIGNAL(clicked()), this, SLOT(OutputUnconnectedPointValues()) );
}
}
| void QmitkTbssView::CreateQtPartControl | ( | QWidget * | parent ) | [virtual] |
Implements berry::QtViewPart.
Definition at line 195 of file QmitkTbssView.cpp.
References berry::SmartPointer< TObjectType >::Cast(), CreateConnections(), berry::WorkbenchPart::GetSite(), m_Controls, m_CurrentSelection, m_IsInitialized, m_SelListener, and TbSelListener.
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkTbssViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
}
m_IsInitialized = false;
m_SelListener = berry::ISelectionListener::Pointer(new TbSelListener(this));
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddPostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener);
berry::ISelection::ConstPointer sel(
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
m_CurrentSelection = sel.Cast<const IStructuredSelection>();
m_SelListener.Cast<TbSelListener>()->DoSelectionChanged(sel);
}
| void QmitkTbssView::Deactivated | ( | ) | [virtual] |
Only called when IsExclusiveFunctionality() returns true.
Reimplemented from QmitkFunctionality.
Definition at line 243 of file QmitkTbssView.cpp.
| RoiImageType::IndexType QmitkTbssView::FindNextPoint | ( | std::vector< RoiImageType::IndexType > | pointsVisited, |
| RoiImageType::IndexType | currentPoint, | ||
| RoiImageType::Pointer | roi, | ||
| bool & | ready | ||
| ) | [protected] |
Definition at line 485 of file QmitkTbssView.cpp.
References PointVisited().
Referenced by SortPoints().
{
RoiImageType::IndexValueType dx[26] = {0, 0, 1, 1, 1, 0,-1,-1,-1,0,1,1, 1, 0,-1,-1,-1, 0, 1, 1, 1, 0,-1,-1,-1, 0};
RoiImageType::IndexValueType dy[26] = {0, 1, 1, 0,-1,-1,-1, 0, 1,1,1,0,-1,-1,-1, 0, 1, 1, 1, 0,-1,-1,-1, 0, 1, 0};
RoiImageType::IndexValueType dz[26] = {0, 0, 0, 0, 0, 0, 0, 0, 0,1,1,1, 1, 1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1, 1};
RoiImageType::IndexType newPoint;
for (int step=0; step<26; step++)
{
newPoint[0] = currentPoint[0] + dx[step];
newPoint[1] = currentPoint[1] + dy[step];
newPoint[2] = currentPoint[2] + dz[step];
// Check if point is not yet visited
if(!PointVisited(pointsVisited, newPoint))
{
if(roi->GetPixel(newPoint) == 1)
return newPoint;
}
}
// No points yet to be visited found so we are done searching
ready = true;
return currentPoint;
}
| void QmitkTbssView::OutputUnconnectedPointValues | ( | ) | [protected, slot] |
Definition at line 262 of file QmitkTbssView.cpp.
References mitk::CastToItkImage(), m_SkeletonNode, and QuadProgPP::t().
Referenced by CreateConnections().
{
if(m_SkeletonNode.IsNull())
{
return;
}
//read roi
/*mitk::Image::Pointer image = dynamic_cast<mitk::Image*>( m_RoiNode->GetData() );
RoiImageType::Pointer roi = RoiImageType::New();
mitk::CastToItkImage(image, roi);*/
//read the 4D skeleton
mitk::Image::Pointer image2 = dynamic_cast<mitk::Image*>( m_SkeletonNode->GetData() );
AllSkeletonType::Pointer skeleton = AllSkeletonType::New();
mitk::CastToItkImage(image2, skeleton);
// RoiImageType::SizeType roiSize = roi->GetLargestPossibleRegion().GetSize();
AllSkeletonType::SizeType skeletonSize = skeleton->GetLargestPossibleRegion().GetSize();
AllSkeletonType::IndexType indices[3];
indices[2][0] = 98; indices[2][1] = 126; indices[2][2] = 105;
indices[3][0] = 101; indices[3][1] = 98; indices[3][2] = 104;
indices[4][0] = 101; indices[4][1] = 76; indices[4][2] = 92;
// output file
std::string filename = "G://home//vanbrugg//spie2011//CingulumHealthy.csv";
std::ofstream f;
f.open(filename.c_str());
for (int s=0; s<skeletonSize[3]; s++)
{
for(int t=0; t<3; t++)
{
indices[t][3] = s;
f << skeleton->GetPixel(indices[t]) << ",";
}
f << std::endl;
}
f.close();
//for(int x=0; x<roiSize[0]; x++)
//{
// for(int y=0; y<roiSize[1]; y++)
// {
// for(int z=0; z<roiSize[2]; z++)
// {
// RoiImageType::IndexType index;
// index[0] = x;
// index[1] = y;
// index[2] = z;
// if (roi->GetPixel(index) != 0)
// {
// // Output the values of this point for all subjects
// AllSkeletonType::IndexType skeletonIndex;
// skeletonIndex[0] = index[0];
// skeletonIndex[1] = index[1];
// skeletonIndex[2] = index[2];
//
// for(int t=0; t<skeletonSize[3]; t++)
// {
// if(index[0] == 90 && index[1] == 98 && index[2] == 95)
// {
// std::cout << "the empty voxel" << std::endl;
// }
// skeletonIndex[3] = t;
// std::cout << skeleton->GetPixel(skeletonIndex) << std::endl;
// }
// std::cout << " ";
// }
// }
// }
//}
}
| void QmitkTbssView::OutputValues | ( | ) | [protected, slot] |
Definition at line 345 of file QmitkTbssView.cpp.
References mitk::CastToItkImage(), m_RoiNode, m_SkeletonNode, and SortPoints().
Referenced by CreateConnections().
{
if(m_SkeletonNode.IsNull() || m_RoiNode.IsNull())
{
return;
}
//read roi
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>( m_RoiNode->GetData() );
RoiImageType::Pointer roi = RoiImageType::New();
mitk::CastToItkImage(image, roi);
//read the 4D skeleton
mitk::Image::Pointer image2 = dynamic_cast<mitk::Image*>( m_SkeletonNode->GetData() );
AllSkeletonType::Pointer skeleton = AllSkeletonType::New();
mitk::CastToItkImage(image2, skeleton);
RoiImageType::SizeType roiSize = roi->GetLargestPossibleRegion().GetSize();
AllSkeletonType::SizeType skeletonSize = skeleton->GetLargestPossibleRegion().GetSize();
std::vector<RoiImageType::IndexType> indices = SortPoints(roi);
//For every subject (4th axis of the 4D volume) output the tract of interest and write results to file
std::string filename = "G://home//vanbrugg//spie2011//paraHipLeftHealthy.csv";
std::ofstream f;
f.open(filename.c_str());
for (int s=0; s<skeletonSize[3]; s++)
{
std::vector<RoiImageType::IndexType>::iterator it = indices.begin();
while(it != indices.end())
{
RoiImageType::IndexType roiIndex = *it;
AllSkeletonType::IndexType skeletonIndex;
skeletonIndex[0] = roiIndex[0];
skeletonIndex[1] = roiIndex[1];
skeletonIndex[2] = roiIndex[2];
skeletonIndex[3] = s;
//std::cout << skeleton->GetPixel(skeletonIndex) << ",";
f << skeleton->GetPixel(skeletonIndex) << ",";
++it;
}
f << std::endl;
}
f.close();
//for(int x=0; x<roiSize[0]; x++)
//{
// for(int y=0; y<roiSize[1]; y++)
// {
// for(int z=0; z<roiSize[2]; z++)
// {
// RoiImageType::IndexType index;
// index[0] = x;
// index[1] = y;
// index[2] = z;
// if (roi->GetPixel(index) != 0)
// {
// // Output the values of this point for all subjects
// AllSkeletonType::IndexType skeletonIndex;
// skeletonIndex[0] = index[0];
// skeletonIndex[1] = index[1];
// skeletonIndex[2] = index[2];
//
// for(int t=0; t<skeletonSize[3]; t++)
// {
// if(index[0] == 90 && index[1] == 98 && index[2] == 95)
// {
// std::cout << "the empty voxel" << std::endl;
// }
// skeletonIndex[3] = t;
// std::cout << skeleton->GetPixel(skeletonIndex) << std::endl;
// }
// std::cout << " ";
// }
// }
// }
//}
}
| bool QmitkTbssView::PointVisited | ( | std::vector< RoiImageType::IndexType > | points, |
| RoiImageType::IndexType | point | ||
| ) | [protected] |
Definition at line 468 of file QmitkTbssView.cpp.
Referenced by FindNextPoint().
{
bool ret = false;
std::vector<RoiImageType::IndexType>::iterator it = points.begin();
while(it != points.end())
{
RoiImageType::IndexType p = *it;
if(p[0] == point[0] && p[1] == point[1] && p[2] == point[2])
{
ret = true;
}
++it;
}
return ret;
}
| void QmitkTbssView::RoiSelected | ( | mitk::DataNode::Pointer | roiNode ) | [protected] |
Definition at line 255 of file QmitkTbssView.cpp.
References m_Controls, and m_RoiNode.
{
m_RoiNode = roiNode;
m_RoiNode->SetVisibility(true);
m_Controls->m_RoiNameLabel->setText(QString::fromStdString(m_RoiNode->GetName()));
}
| void QmitkTbssView::SetDefaultNodeProperties | ( | mitk::DataNode::Pointer | node, |
| std::string | name | ||
| ) | [protected] |
| void QmitkTbssView::SkeletonSelected | ( | mitk::DataNode::Pointer | skeletonNode ) | [protected] |
Definition at line 248 of file QmitkTbssView.cpp.
References m_Controls, and m_SkeletonNode.
{
m_SkeletonNode = skeletonNode;
m_SkeletonNode->SetVisibility(true);
m_Controls->m_SkeletonNameLabel->setText(QString::fromStdString(m_SkeletonNode->GetName()));
}
| std::vector< RoiImageType::IndexType > QmitkTbssView::SortPoints | ( | RoiImageType::Pointer | roi ) | [protected] |
Definition at line 440 of file QmitkTbssView.cpp.
References FindNextPoint().
Referenced by OutputValues().
{
std::vector<RoiImageType::IndexType> indices;
//set current point to be the start point. Hard coded for now, should be changed to function in general
RoiImageType::IndexType currentPoint;
//currentPoint[0] = 90; // For Corpus Callosum the constant index;
//currentPoint[1] = 88;
//currentPoint[2] = 82;
//currentPoint[0] = 65; //standard for right parahippocampal white matter
//currentPoint[1] = 108;
//currentPoint[2] = 45;
currentPoint[0] = 95;
currentPoint[1] = 166;
currentPoint[2] = 78;
bool ready = false;
while(!ready)
{
indices.push_back(currentPoint);
currentPoint = FindNextPoint(indices, currentPoint, roi, ready);
}
return indices;
}
| void QmitkTbssView::StdMultiWidgetAvailable | ( | QmitkStdMultiWidget & | stdMultiWidget ) | [virtual] |
Called when a StdMultiWidget is available. Should not be used anymore, see GetActiveStdMultiWidget()
Reimplemented from QmitkFunctionality.
Definition at line 215 of file QmitkTbssView.cpp.
References berry::SmartPointer< TObjectType >::Cast(), berry::WorkbenchPart::GetSite(), m_CurrentSelection, m_MultiWidget, and m_SelListener.
{
berry::ISelection::ConstPointer sel(
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
m_CurrentSelection = sel.Cast<const IStructuredSelection>();
m_SelListener.Cast<TbSelListener>()->DoSelectionChanged(sel);
m_MultiWidget = &stdMultiWidget;
}
| void QmitkTbssView::StdMultiWidgetNotAvailable | ( | ) | [virtual] |
Called when no StdMultiWidget is available anymore. Should not be used anymore, see GetActiveStdMultiWidget()
Reimplemented from QmitkFunctionality.
Definition at line 224 of file QmitkTbssView.cpp.
References m_MultiWidget.
{
m_MultiWidget = NULL;
}
friend struct TbSelListener [friend] |
Definition at line 57 of file QmitkTbssView.h.
Referenced by CreateQtPartControl().
Ui::QmitkTbssViewControls* QmitkTbssView::m_Controls [protected] |
Definition at line 95 of file QmitkTbssView.h.
Referenced by CreateConnections(), CreateQtPartControl(), RoiSelected(), and SkeletonSelected().
Definition at line 103 of file QmitkTbssView.h.
Referenced by CreateQtPartControl(), TbSelListener::DoSelectionChanged(), and StdMultiWidgetAvailable().
bool QmitkTbssView::m_IsInitialized [protected] |
Definition at line 105 of file QmitkTbssView.h.
Referenced by CreateQtPartControl().
QmitkStdMultiWidget* QmitkTbssView::m_MultiWidget [protected] |
Definition at line 97 of file QmitkTbssView.h.
Referenced by StdMultiWidgetAvailable(), and StdMultiWidgetNotAvailable().
mitk::DataNode::Pointer QmitkTbssView::m_RoiNode [protected] |
Definition at line 111 of file QmitkTbssView.h.
Referenced by OutputValues(), and RoiSelected().
Definition at line 102 of file QmitkTbssView.h.
Referenced by CreateQtPartControl(), StdMultiWidgetAvailable(), and ~QmitkTbssView().
mitk::DataNode::Pointer QmitkTbssView::m_SkeletonNode [protected] |
Definition at line 110 of file QmitkTbssView.h.
Referenced by OutputUnconnectedPointValues(), OutputValues(), and SkeletonSelected().
const int QmitkTbssView::nrconvkernels [static] |
Definition at line 82 of file QmitkTbssView.h.
const std::string QmitkTbssView::VIEW_ID = "org.mitk.views.tbss" [static] |
Definition at line 64 of file QmitkTbssView.h.
1.7.2