// floor() is used to intentionally reduce the number of slices
// because, from a clinical point of view, it's better to
// remove data than to add data that privously didn't exist.
+ if(inputSpacing[i]*m_OutputSpacing[i]<0)
+ itkExceptionMacro( << "Input and output spacings don't have the same signs, can't cope with that" );
m_OutputSize[i] = (int)floor(inputSize[i]*inputSpacing[i]/m_OutputSpacing[i]);
}
} else {
if (m_OutputSpacing[0] != -1) { // apply spacing, compute size
for(unsigned int i=0; i<dim; i++) {
+ if(inputSpacing[i]*m_OutputSpacing[i]<0)
+ itkExceptionMacro( << "Input and output spacings don't have the same signs, can't cope with that" );
// see comment above for the use of floor()
m_OutputSize[i] = (int)floor(inputSize[i]*inputSpacing[i]/m_OutputSpacing[i]);
}
m_OutputSize[l] = inputSize[l];
m_OutputSpacing[l] = inputSpacing[l];
}
-
+
// Set Size/Spacing
OutputImagePointer outputImage = this->GetOutput(0);
// OutputImageRegionType region;
#include "clitkCommon.h"
#include "clitkAutoCropFilter.h"
#include "clitkLabelizeParameters.h"
+#include "clitkExtractSliceFilter.h"
// itk
#include <itkBoundingBox.h>
//--------------------------------------------------------------------
template<class ImageType>
void
- ExtractSlices(const ImageType * image, int dim,
- std::vector< typename itk::Image<typename ImageType::PixelType,
- ImageType::ImageDimension-1>::Pointer > & slices);
+ ExtractSlices(const ImageType * image, int direction,
+ std::vector<typename itk::Image<typename ImageType::PixelType,
+ ImageType::ImageDimension-1>::Pointer > & slices)
+ {
+ typedef ExtractSliceFilter<ImageType> ExtractSliceFilterType;
+ typedef typename ExtractSliceFilterType::SliceType SliceType;
+ typename ExtractSliceFilterType::Pointer
+ extractSliceFilter = ExtractSliceFilterType::New();
+ extractSliceFilter->SetInput(image);
+ extractSliceFilter->SetDirection(direction);
+ extractSliceFilter->Update();
+ extractSliceFilter->GetOutputSlices(slices);
+ }
//--------------------------------------------------------------------
p[dim] = max;
typename ImageType::IndexType end;
image->TransformPhysicalPointToIndex(p, end);
- size[dim] = fabs(end[dim]-start[dim]);
+ size[dim] = abs(end[dim]-start[dim]);
region.SetIndex(start);
region.SetSize(size);
//--------------------------------------------------------------------
- //--------------------------------------------------------------------
- template<class ImageType>
- void
- ExtractSlices(const ImageType * image, int direction,
- std::vector<typename itk::Image<typename ImageType::PixelType,
- ImageType::ImageDimension-1>::Pointer > & slices)
- {
- typedef ExtractSliceFilter<ImageType> ExtractSliceFilterType;
- typedef typename ExtractSliceFilterType::SliceType SliceType;
- typename ExtractSliceFilterType::Pointer
- extractSliceFilter = ExtractSliceFilterType::New();
- extractSliceFilter->SetInput(image);
- extractSliceFilter->SetDirection(direction);
- extractSliceFilter->Update();
- extractSliceFilter->GetOutputSlices(slices);
- }
- //--------------------------------------------------------------------
-
-
//--------------------------------------------------------------------
template<class ImageType>
void
std::vector<itk::Point<double, Dim-1> > previous;
HypercubeCorners<Dim-1>(previous);
out.resize(previous.size()*2);
- for(uint i=0; i<out.size(); i++) {
+ for(unsigned int i=0; i<out.size(); i++) {
itk::Point<double, Dim> p;
if (i<previous.size()) p[0] = 0;
else p[0] = 1;
std::vector<typename ImageType::PointType> & bounds)
{
// Get image max/min coordinates
- const uint dim=ImageType::ImageDimension;
+ const unsigned int dim=ImageType::ImageDimension;
typedef typename ImageType::PointType PointType;
typedef typename ImageType::IndexType IndexType;
PointType min_c, max_c;
IndexType min_i, max_i;
min_i = image->GetLargestPossibleRegion().GetIndex();
- for(uint i=0; i<dim; i++) max_i[i] = image->GetLargestPossibleRegion().GetSize()[i] + min_i[i];
+ for(unsigned int i=0; i<dim; i++)
+ max_i[i] = image->GetLargestPossibleRegion().GetSize()[i] + min_i[i];
image->TransformIndexToPhysicalPoint(min_i, min_c);
image->TransformIndexToPhysicalPoint(max_i, max_c);
// Get corners coordinates
HypercubeCorners<ImageType::ImageDimension>(bounds);
- for(uint i=0; i<bounds.size(); i++) {
- for(uint j=0; j<dim; j++) {
+ for(unsigned int i=0; i<bounds.size(); i++) {
+ for(unsigned int j=0; j<dim; j++) {
if (bounds[i][j] == 0) bounds[i][j] = min_c[j];
if (bounds[i][j] == 1) bounds[i][j] = max_c[j];
}
clitk::ExtractSlices<MaskImageType>(Aorta, 2, slices_Aorta);
std::vector<MaskSlicePointer> slices_Trachea;
clitk::ExtractSlices<MaskImageType>(Trachea, 2, slices_Trachea);
- uint n= slices_BrachioCephalicArtery.size();
+ unsigned int n= slices_BrachioCephalicArtery.size();
// Get the boundaries of one slice
std::vector<MaskSlicePointType> bounds;
std::vector<MaskImagePointType> p3D;
vtkSmartPointer<vtkAppendPolyData> append = vtkSmartPointer<vtkAppendPolyData>::New();
- for(uint i=0; i<n; i++) {
+ for(unsigned int i=0; i<n; i++) {
// Labelize the slices
slices_CommonCarotidArtery[i] = Labelize<MaskSliceType>(slices_CommonCarotidArtery[i],
GetBackgroundValue(), true, 1);
centroids6.clear();
}
- for(uint j=1; j<centroids1.size(); j++) points2D.push_back(centroids1[j]);
- for(uint j=1; j<centroids2.size(); j++) points2D.push_back(centroids2[j]);
- for(uint j=1; j<centroids3.size(); j++) points2D.push_back(centroids3[j]);
- for(uint j=1; j<centroids4.size(); j++) points2D.push_back(centroids4[j]);
- for(uint j=1; j<centroids5.size(); j++) points2D.push_back(centroids5[j]);
- for(uint j=1; j<centroids6.size(); j++) points2D.push_back(centroids6[j]);
+ for(unsigned int j=1; j<centroids1.size(); j++) points2D.push_back(centroids1[j]);
+ for(unsigned int j=1; j<centroids2.size(); j++) points2D.push_back(centroids2[j]);
+ for(unsigned int j=1; j<centroids3.size(); j++) points2D.push_back(centroids3[j]);
+ for(unsigned int j=1; j<centroids4.size(); j++) points2D.push_back(centroids4[j]);
+ for(unsigned int j=1; j<centroids5.size(); j++) points2D.push_back(centroids5[j]);
+ for(unsigned int j=1; j<centroids6.size(); j++) points2D.push_back(centroids6[j]);
// Sort by angle according to trachea centroid and vertical line,
// in polar coordinates :
ComputeCentroids<MaskSliceType>(slices_Trachea[i], GetBackgroundValue(), centroids_trachea);
typedef std::pair<MaskSlicePointType, double> PointAngleType;
std::vector<PointAngleType> angles;
- for(uint j=0; j<points2D.size(); j++) {
+ for(unsigned int j=0; j<points2D.size(); j++) {
//double r = centroids_trachea[1].EuclideanDistanceTo(points2D[j]);
double x = (points2D[j][0]-centroids_trachea[1][0]); // X : Right to Left
double y = (centroids_trachea[1][1]-points2D[j][1]); // Y : Post to Ant
// Sort points2D according to polar angles
std::sort(angles.begin(), angles.end(), comparePointsWithAngle<PointAngleType>());
- for(uint j=0; j<angles.size(); j++) {
+ for(unsigned int j=0; j<angles.size(); j++) {
points2D[j] = angles[j].first;
}
// DDV(points2D, points2D.size());
low, add one point
*/
std::vector<MaskSlicePointType> toadd;
- uint index = 0;
+ unsigned int index = 0;
double dmax = 5;
while (index<points2D.size()-1) {
MaskSlicePointType a = points2D[index];
// Build 3D points from the 2D points
std::vector<ImagePointType> points3D;
clitk::PointsUtils<MaskImageType>::Convert2DListTo3DList(points2D, i, m_Working_Support, points3D);
- for(uint x=0; x<points3D.size(); x++) p3D.push_back(points3D[x]);
+ for(unsigned int x=0; x<points3D.size(); x++) p3D.push_back(points3D[x]);
// Build the mesh from the contour's points
vtkSmartPointer<vtkPolyData> mesh = Build3DMeshFrom2DContour(points3D);
#=========================================================
#Create binary and libs for tests
-SET(vvExternalLibs clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foundationLibraries})
+SET(vvExternalLibs ${QT_QTNETWORK_LIBRARY} clitkSegmentationGgoLib clitkDicomRTStruct ${toolLibs} ${foundationLibraries})
+# QtNetwork is required by vvRegisterForm
ADD_LIBRARY(vvLib ${vv_SRCS} ${vv_UI_CXX})
TARGET_LINK_LIBRARIES(vvLib ${vvExternalLibs})
ENDIF(WIN32)
#TARGET_LINK_LIBRARIES(vv vvLib)
-# QtNetwork added specifically for Fedora build
-TARGET_LINK_LIBRARIES(vv vvLib QtNetwork)
+TARGET_LINK_LIBRARIES(vv vvLib)
#=========================================================
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">u</span><span style=" font-size:12pt;">: </span><span style=" font-size:12pt; text-decoration: underline;">U</span><span style=" font-size:12pt;">pdate Image</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">f</span><span style=" font-size:12pt;">: </span><span style=" font-size:12pt; text-decoration: underline;">F</span><span style=" font-size:12pt;">ly To Mouse Position</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">g</span><span style=" font-size:12pt;">: </span><span style=" font-size:12pt; text-decoration: underline;">G</span><span style=" font-size:12pt;">o to Crosshair Position</span></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">o</span><span style=" font-size:12pt;">: Go to Image </span><span style=" font-size:12pt; text-decoration: underline;">O</span><span style=" font-size:12pt;">rigin</span></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Ctrl+g</span><span style=" font-size:12pt;">: </span><span style=" font-size:12pt; text-decoration: underline;">G</span><span style=" font-size:12pt;">o to Coordinate System Origin</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">h</span><span style=" font-size:12pt;">: </span><span style=" font-size:12pt; text-decoration: underline;">H</span><span style=" font-size:12pt;">ide Crosshair and corner annotations</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Up,Down</span><span style=" font-size:12pt;">: Change Slice</span></p>
void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax)
{
int position = int((min+max)/2);
- int tPosition = int((tmin+tmax)/2);
if (slicer == 0) {
NOVerticalSlider->setValue(position);
NOVerticalSlider->setRange(min,max);
NOHorizontalSlider->setRange(tmin,tmax);
- NOHorizontalSlider->setValue(tPosition);
} else if (slicer == 1) {
NEVerticalSlider->setValue(position);
NEVerticalSlider->setRange(min,max);
NEHorizontalSlider->setRange(tmin,tmax);
- NEHorizontalSlider->setValue(tPosition);
} else if (slicer == 2) {
SOVerticalSlider->setValue(position);
SOVerticalSlider->setRange(min,max);
SOHorizontalSlider->setRange(tmin,tmax);
- SOHorizontalSlider->setValue(tPosition);
} else if (slicer == 3) {
SEVerticalSlider->setValue(position);
SEVerticalSlider->setRange(min,max);
SEHorizontalSlider->setRange(tmin,tmax);
- SEHorizontalSlider->setValue(tPosition);
}
}
//------------------------------------------------------------------------------
mVFColor[1] = 1;
mVFColor[2] = 0;
- std::string text = "F1 = sagital; F2 = coronal; F3 = axial\n";
- text += "F5 = horizontal flip; F6 = vertical flip\n\n";
- text += "0,1,2,3,4,5 : preset windowing\n";
- text += "6,7,8,9 : preset colormap\n";
- text += "z : local windowing\n";
- text += "r : reset view\n";
- text += "l : reload image\n";
- text += "f : fly to mouse position\n";
- text += "g : go to cross hair position\n\n";
- text += "Up,down : change slice\n";
- text += "Left,right : change tenporal slice\n\n";
- text += "Scrollbar (or w/x) : zoom in/out\n";
- text += "left button : synchronize all views\n";
- text += "middle button : grab image\n";
- text += "right button : change windowing\n";
-
crossCursor = vtkSmartPointer<vtkCursor2D>::New();
crossCursor->AllOff();
crossCursor->AxesOn();
reslice->SetOutputOrigin(origin);
reslice->SetOutputSpacing(spacing);
reslice->UpdateInformation();
+ reslice->GetOutput()->UpdateInformation();
}
//------------------------------------------------------------------------------
if ( VisibleInWindow > -1 ) {
if (event == vtkCommand::KeyPressEvent) {
std::string KeyPress = isi->GetInteractor()->GetKeySym();
+ bool bCtrlKey = isi->GetInteractor()->GetControlKey();
if (KeyPress == "Tab") {
if(isi->GetInteractor()->GetShiftKey())
this->SM->PrevImage(VisibleInWindow);
return;
}
if (KeyPress == "g") {
- double* cursorPos = this->SM->GetSlicer(VisibleInWindow)->GetCursorPosition();
- this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(
- cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
- this->SM->UpdateViews(1,VisibleInWindow);
- this->SM->UpdateLinked(VisibleInWindow);
- return;
- }
- if (KeyPress == "o") {
- this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(0,0,0,0);
+ if(bCtrlKey)
+ this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(0,0,0,0);
+ else {
+ double* cursorPos = this->SM->GetSlicer(VisibleInWindow)->GetCursorPosition();
+ this->SM->GetSlicer(VisibleInWindow)->SetCurrentPosition(
+ cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
+ }
this->SM->UpdateViews(1,VisibleInWindow);
this->SM->UpdateLinked(VisibleInWindow);
return;