Commit 7b3979d5 authored by Emmanuel Promayon's avatar Emmanuel Promayon

FIXED code cleaning

parent db14f32a
......@@ -156,7 +156,7 @@ void ImageComponent::initImageProperties() {
// from QObject documentation, section "Detailed Description":
// "To avoid never ending notification loops you can temporarily block signals with blockSignals()."
setProperty("Image Name", QVariant(getName()));
if (originalImageData) {
if (originalImageData != nullptr) {
int* imgDims = originalImageData->GetDimensions();
QString imageDims = "(";
......@@ -378,7 +378,7 @@ vtkSmartPointer<vtkImageData> ImageComponent::getImageDataWithFrameTransform() {
void ImageComponent::initLookupTable() {
// TODO set in a betterway information about the lut thanks to image data
if (this->originalImageData->GetNumberOfScalarComponents() == 1) {
if (originalImageData->GetNumberOfScalarComponents() == 1) {
// Default values for grey level lut
lut->SetTableRange(0, 255);
lut->SetSaturationRange(1.0, 1.0);
......@@ -401,84 +401,84 @@ void ImageComponent::initLookupTable() {
// -------------------- replaceImageData --------------------
void ImageComponent::replaceImageData(vtkSmartPointer<vtkImageData> anImageData, bool copy, ImageOrientationHelper::PossibleImageOrientations initialOrientation) {
// Delete ImageComponents
if (axialSlices) {
if (axialSlices != nullptr) {
removeChild(axialSlices);
delete axialSlices;
axialSlices = nullptr;
}
if (coronalSlices) {
if (coronalSlices != nullptr) {
removeChild(coronalSlices);
delete coronalSlices;
coronalSlices = nullptr;
}
if (sagittalSlices) {
if (sagittalSlices != nullptr) {
removeChild(sagittalSlices);
delete sagittalSlices;
sagittalSlices = nullptr;
}
if (arbitrarySlices) {
if (arbitrarySlices != nullptr) {
removeChild(arbitrarySlices);
delete arbitrarySlices;
arbitrarySlices = nullptr;
}
if (volumeRenderingChild) {
if (volumeRenderingChild != nullptr) {
removeChild(volumeRenderingChild);
delete volumeRenderingChild;
volumeRenderingChild = nullptr;
}
this->refreshInterfaceNode();
refreshInterfaceNode();
setImageData(anImageData, copy, initialOrientation);
this->refreshInterfaceNode();
refreshInterfaceNode();
}
// -------------------- getAxialSlices --------------------
SingleImageComponent* ImageComponent::getAxialSlices() {
return this->axialSlices;
return axialSlices;
}
// -------------------- getCoronalSlices --------------------
SingleImageComponent* ImageComponent::getCoronalSlices() {
return this->coronalSlices;
return coronalSlices;
}
// -------------------- getSagittalSlices --------------------
SingleImageComponent* ImageComponent::getSagittalSlices() {
return this->sagittalSlices;
return sagittalSlices;
}
// -------------------- getArbitrarySlices --------------------
SingleImageComponent* ImageComponent::getArbitrarySlices() {
return this->arbitrarySlices;
return arbitrarySlices;
}
// -------------------- setSingleImageComponents --------------------
void ImageComponent::setSingleImageComponents(SingleImageComponent* axialSlices, SingleImageComponent* sagittalSlices, SingleImageComponent* coronalSlices, SingleImageComponent* arbitrarySlices) {
if (this->axialSlices && axialSlices != this->axialSlices) {
if (this->axialSlices != nullptr && axialSlices != this->axialSlices) {
removeChild(this->axialSlices);
delete this->axialSlices;
this->axialSlices = axialSlices;
}
if (this->coronalSlices && coronalSlices != this->coronalSlices) {
if (this->coronalSlices != nullptr && coronalSlices != this->coronalSlices) {
removeChild(this->coronalSlices);
delete this->coronalSlices;
this->coronalSlices = coronalSlices;
}
if (this->sagittalSlices && sagittalSlices != this->sagittalSlices) {
if (this->sagittalSlices != nullptr && sagittalSlices != this->sagittalSlices) {
removeChild(this->sagittalSlices);
delete this->sagittalSlices;
this->sagittalSlices = sagittalSlices;
}
if (this->arbitrarySlices && arbitrarySlices != this->arbitrarySlices) {
if (this->arbitrarySlices != nullptr && arbitrarySlices != this->arbitrarySlices) {
removeChild(this->arbitrarySlices);
delete this->arbitrarySlices;
this->arbitrarySlices = arbitrarySlices;
......@@ -487,7 +487,7 @@ void ImageComponent::setSingleImageComponents(SingleImageComponent* axialSlices,
// ---------------- getVolumeRenderingChild -------------------
MeshComponent* ImageComponent::getVolumeRenderingChild() {
return this->volumeRenderingChild;
return volumeRenderingChild;
}
// -------------------- setImageName --------------------
......@@ -505,24 +505,24 @@ QString ImageComponent::getImageName() const {
void ImageComponent::update3DViewer() {
bool viewIn3D = property("Display Image in 3D Viewer").toBool();
if (axialSlices) {
if (axialSlices != nullptr) {
axialSlices->setViewSliceIn3D(viewIn3D);
}
if (coronalSlices) {
if (coronalSlices != nullptr) {
coronalSlices->setViewSliceIn3D(viewIn3D);
}
if (sagittalSlices) {
if (sagittalSlices != nullptr) {
sagittalSlices->setViewSliceIn3D(viewIn3D);
}
if (arbitrarySlices) {
if (arbitrarySlices != nullptr) {
// by default never visible in 3D
arbitrarySlices->setViewSliceIn3D(false);
}
if (volumeRenderingChild) {
if (volumeRenderingChild != nullptr) {
volumeRenderingChild->setVisibility(InteractiveViewer::get3DViewer(), viewIn3D);
}
......@@ -530,25 +530,24 @@ void ImageComponent::update3DViewer() {
// -------------------- buildImageComponents --------------------
void ImageComponent::buildImageComponents() {
if (!axialSlices) {
if (axialSlices == nullptr) {
axialSlices = new SingleImageComponent(this, Slice::AXIAL, "Axial view", lut);
}
if (this->originalImageData->GetDataDimension() == 3) {
if (!coronalSlices) {
if (coronalSlices == nullptr) {
coronalSlices = new SingleImageComponent(this, Slice::CORONAL, "Coronal view", lut);
}
if (!sagittalSlices) {
if (sagittalSlices == nullptr) {
sagittalSlices = new SingleImageComponent(this, Slice::SAGITTAL, "Sagittal view", lut);
}
if (!arbitrarySlices) {
// TODO implement arbitrary slice orientation
if (arbitrarySlices == nullptr) {
arbitrarySlices = new SingleImageComponent(this, Slice::ARBITRARY, "Arbitrary view", lut);
}
if (volumeRenderingChild) {
if (volumeRenderingChild != nullptr) {
delete volumeRenderingChild;
}
......@@ -558,31 +557,26 @@ void ImageComponent::buildImageComponents() {
volumeRenderingChild->setRenderingModes(InterfaceGeometry::Wireframe);
volumeRenderingChild->setParentFrame(getFrame());
}
else {
if (coronalSlices) {
if (coronalSlices != nullptr) {
delete coronalSlices;
coronalSlices = nullptr;
}
coronalSlices = nullptr;
if (sagittalSlices) {
if (sagittalSlices != nullptr) {
delete sagittalSlices;
sagittalSlices = nullptr;
}
sagittalSlices = nullptr;
if (arbitrarySlices) {
if (arbitrarySlices != nullptr) {
delete arbitrarySlices;
arbitrarySlices = nullptr;
}
arbitrarySlices = nullptr;
if (volumeRenderingChild) {
if (volumeRenderingChild != nullptr) {
delete volumeRenderingChild;
volumeRenderingChild = nullptr;
}
volumeRenderingChild = nullptr;
}
// Let there be slices...
......@@ -592,19 +586,19 @@ void ImageComponent::buildImageComponents() {
// -------------------- updateImageComponents --------------------
void ImageComponent::updateImageComponents() {
if (axialSlices) {
if (axialSlices != nullptr) {
axialSlices->setOriginalVolume(originalImageData);
}
if (coronalSlices) {
if (coronalSlices != nullptr) {
coronalSlices->setOriginalVolume(originalImageData);
}
if (sagittalSlices) {
if (sagittalSlices != nullptr) {
sagittalSlices->setOriginalVolume(originalImageData);
}
if (arbitrarySlices) {
if (arbitrarySlices != nullptr) {
arbitrarySlices->setOriginalVolume(originalImageData);
}
......@@ -687,7 +681,7 @@ double ImageComponent::getActualMaxColor() const {
// -------------------- getNumberOfSlices --------------------
int ImageComponent::getNumberOfSlices() const {
return this->axialSlices->getNumberOfSlices();
return axialSlices->getNumberOfSlices();
}
// -------------------- setLut --------------------
......@@ -696,8 +690,8 @@ void ImageComponent::setLut(vtkSmartPointer<vtkWindowLevelLookupTable> lookupTab
}
// -------------------- getLut --------------------
vtkSmartPointer<vtkWindowLevelLookupTable> ImageComponent::getLut() {
return this->lut;
vtkSmartPointer<vtkWindowLevelLookupTable> ImageComponent::getLut() {
return lut;
}
// -------------------- setSelected --------------------
......@@ -740,7 +734,6 @@ void ImageComponent::getLastPointPickedWorldCoords(double* x, double* y, double*
*x = wxyz[0];
*y = wxyz[1];
*z = wxyz[2];
}
// -------------------- refresh --------------------
......@@ -752,8 +745,8 @@ void ImageComponent::refresh() const {
// -------------------- getBoundingBox --------------------
vtkSmartPointer<vtkPolyData> ImageComponent::getBoundingBox() {
if (! originalImageData) {
return NULL;
if (originalImageData == nullptr) {
return nullptr;
}
double* bounds = originalImageData->GetBounds();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment