From 5ea11691ed53fd2f448f9c02677abfcef2c07e1c Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Wed, 15 May 2024 09:27:00 +0200 Subject: [PATCH 01/20] [4.0.3] release with debugs from manips tests and switch to ub22 (#851) * [Ubuntu] switch to ITK5.2.1 to be compatible with Ubuntu22 (#847) * switch to ITK5.2.1 to be compatible with Ubuntu22 * [Ubuntu22] adapt to python needs in VTK config * [compilation] switch to rebased branch * [TTK] maj required components * [Repos] switch to asclepios music 4.1 branch * [ITK] add modules for macOS and Windows * [Release Notes] add ubuntu 22 line * [4.1.0] switch to future release --------- Co-authored-by: Kun HE * [PolygonROI] labels: contrasted icons, setObjectName, render ROI after label change (#849) * [PolygonROI] contrasted icons, setObjectName, render ROI * [PolygonROI] add release notes * [4.0.3] release number and notes * [music-plugins] allow to compile on ci to test * [4.0.3] switch to right music repo --------- Co-authored-by: Kun HE --- CMakeLists.txt | 2 +- RELEASE_NOTES.txt | 6 + packaging/apple/settings.json | 2 +- src/CMakeLists.txt | 2 +- src/app/medInria/resources/medInria.qrc | 6 +- .../pixmaps/{minus.png => minus_black.png} | Bin .../resources/pixmaps/minus_white.png | Bin 0 -> 4040 bytes .../pixmaps/{plus.png => plus_black.png} | Bin .../medInria/resources/pixmaps/plus_white.png | Bin 0 -> 3064 bytes .../legacy/medImageIO/itkDCMTKImageIO.cpp | 40 ++--- .../medImageIO/itkDataImageReaderBase.cpp | 40 ++--- .../legacy/medImageIO/itkGISImageIO.cpp | 126 +++++++-------- .../itkMultiThreadedImageIOBase.cpp | 3 +- .../medImageIO/itkMultiThreadedImageIOBase.h | 2 +- .../legacy/medImageIO/medInrimageImageIO.cpp | 150 +++++++++--------- .../legacy/medImageIO/medInrimageImageIO.h | 2 +- src/layers/legacy/medUtilities/CMakeLists.txt | 2 +- .../legacy/LCCLogDemons/CMakeLists.txt | 1 + .../legacy/diffeomorphicDemons/CMakeLists.txt | 1 + .../CMakeLists.txt | 6 +- .../legacy/itkDataImage/CMakeLists.txt | 5 +- .../readers/itkDCMTKDataImageReader.cpp | 30 ++-- .../readers/itkGDCMDataImageReader.cpp | 28 ++-- .../readers/itkDataSHImageReader.cpp | 10 +- .../legacy/itkDataTensorImage/CMakeLists.txt | 7 +- .../readers/itkDataTensorImageReaderBase.cpp | 4 +- src/plugins/legacy/itkFilters/CMakeLists.txt | 4 +- .../CMakeLists.txt | 1 + .../legacy/medAlgorithmPaint/CMakeLists.txt | 1 + .../medAlgorithmPaintToolBox.cpp | 2 +- .../medCompositeDataSets/CMakeLists.txt | 5 +- .../legacy/medSegmentation/CMakeLists.txt | 4 +- .../legacy/medVtkFibersData/CMakeLists.txt | 6 +- .../toolboxes/defaultLabelToolBox.cpp | 30 +++- .../toolboxes/polygonRoiToolBox.cpp | 29 ++-- .../polygonRoi/viewevent/baseViewEvent.cpp | 3 + .../CMakeLists.txt | 6 +- .../morphomath_operation/CMakeLists.txt | 1 + .../process/single_filter/CMakeLists.txt | 1 + .../ttkTensorEstimationProcess/CMakeLists.txt | 6 +- .../ttkTensorScalarMapsProcess/CMakeLists.txt | 6 +- .../CMakeLists.txt | 6 +- superbuild/projects_modules/ITK.cmake | 2 +- superbuild/projects_modules/LogDemons.cmake | 4 +- superbuild/projects_modules/RPI.cmake | 4 +- superbuild/projects_modules/TTK.cmake | 4 +- superbuild/projects_modules/VTK.cmake | 2 + 47 files changed, 327 insertions(+), 275 deletions(-) rename src/app/medInria/resources/pixmaps/{minus.png => minus_black.png} (100%) create mode 100644 src/app/medInria/resources/pixmaps/minus_white.png rename src/app/medInria/resources/pixmaps/{plus.png => plus_black.png} (100%) create mode 100644 src/app/medInria/resources/pixmaps/plus_white.png diff --git a/CMakeLists.txt b/CMakeLists.txt index 32025e72f3..651bf9d8b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ endif() cmake_policy(SET CMP0074 NEW) if(NOT DEFINED ${MEDINRIA_SUPERBUILD_VERSION}) - set(MEDINRIA_SUPERBUILD_VERSION 4.0.2) + set(MEDINRIA_SUPERBUILD_VERSION 4.0.3) endif() SET(CMAKE_CXX_STANDARD 17) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 7325be46ac..640e164b43 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,3 +1,9 @@ +MUSICardio 4.0.3: +- Switch to Ubuntu 22. +- PolygonROI: update icons, fix a glitch when users change ROI label, hide label panel in pipelines. +- Histogram Analysis: enhance memory management and remove useless computation. +- Pipelines: correct arithmetic filters computation. + MUSICardio 4.0.2: - Fix drawing problem in pipelines with custom step of PolygonROI. diff --git a/packaging/apple/settings.json b/packaging/apple/settings.json index 15f0d3c863..20460034eb 100644 --- a/packaging/apple/settings.json +++ b/packaging/apple/settings.json @@ -7,7 +7,7 @@ "window": { "position": { "x": 100, "y": 100 }, "size": { "width": 640, "height": 300 } }, "contents": [ - { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.2/MUSICardio.app" }, + { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.3/MUSICardio.app" }, { "x": 480, "y": 165, "type": "link", "path": "/Applications" } ] } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 41f5a93f67..8f1a4d9f4f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.19) if(NOT DEFINED ${medInria_VERSION}) - set(medInria_VERSION 4.0.2) + set(medInria_VERSION 4.0.3) endif() project(medInria VERSION ${medInria_VERSION}) diff --git a/src/app/medInria/resources/medInria.qrc b/src/app/medInria/resources/medInria.qrc index 3c959b2647..98ebfc770c 100644 --- a/src/app/medInria/resources/medInria.qrc +++ b/src/app/medInria/resources/medInria.qrc @@ -146,8 +146,10 @@ pixmaps/radio-disabled.png pixmaps/radio-checked-disabled.png pixmaps/plus-button.png - pixmaps/plus.png - pixmaps/minus.png + pixmaps/plus_white.png + pixmaps/minus_white.png + pixmaps/plus_black.png + pixmaps/minus_black.png pixmaps/checkbox-disabled.png pixmaps/checkbox-checked-disabled.png pixmaps/arrow-top-disabled.png diff --git a/src/app/medInria/resources/pixmaps/minus.png b/src/app/medInria/resources/pixmaps/minus_black.png similarity index 100% rename from src/app/medInria/resources/pixmaps/minus.png rename to src/app/medInria/resources/pixmaps/minus_black.png diff --git a/src/app/medInria/resources/pixmaps/minus_white.png b/src/app/medInria/resources/pixmaps/minus_white.png new file mode 100644 index 0000000000000000000000000000000000000000..e36cdc667b4f458cf7c047d89b7ec5e5c0202640 GIT binary patch literal 4040 zcmeHJcTiK=8b1Lc6e$+O0s+?*L`qOpKxra%5k-gz1Ofq<0D^!Zy#*dc6af+G-CcnM zDN>~dX$qkzMv&fd0VzTZMc`fD&Kq`ioLSuW$D23v=FFXY&Ue4_o!|Y=@B5t-s&_?` zi{mf{0DwzdOHCgDCaB8<*jS<0lKZ<=XzGctbZ!Y>ItP}i_WfnLJgCiAIAR? zv+^{iCPjE1`&Dwmz`_GnKPP&5RxedOrEo22^lN#->HV!;_j;y3qOIi-ktSbk54Adq zr`#$Hm?&su9aAiEPdj_EKJ7H~@hOze+wL1rg7@y@Vckct2gP>W8bQ5G$863f*rjzf z)IMKeQ;7`}D(+}AcCFS3rzQ_I2jT-U)x9qxMEo*?sGhbgnM@T39 zEb981?3-u<9&8cewU}+&htKE7NTJ6KS_l*9oN{+3`pm>^gYEDSa?HhJ77aRL#ZFmT zs6FJDH7}j!k7}M@dKDt*8~x;*L~2YzNnehK_%qkpx3@1Z^*!@KR&jGMi#BLo(nOr| zj=m=Pz9%~VX`8~WRf$5SEF4O?crZxqE?;W{-CP{znn`nr$c)9Z2)_=x&Y1qI z>rBU*m`-*GSNP5=FDn|0E6Wcb4;odOyg%w42GVh9*PN5)ZZz2>fm*AfpBz@iUGNi+ zmasba5ip-#N`s4z!53nSAb#j|r0$2u0Vq`^p32lWvX=fE#%WfqiN=cpnLH{9gvXUI zZf^fKOqO|Tl@(+k`^^EHwmJCyOs4`y^C1!>MXVM&nrh(lR+CZ-qe2#TM=c{~0QRJB zJurhia8JkxzoV_I4j*TSvmb-?jk6vFfa8s}+C>y3Q~kB~lY$OWh6lq#;RRfWwb&L; zrXSwF>o_)%LoEFa_MWN@vT8gs2BE;d!Q7zpSk>6NpzFZBqUeJ^2}hndbMdNrftG!M z7SpM?T|DpQ6se`B?PYI2>bG;XN`VLCT&=8P85b&*s~ubk<_ZWnpvFGj1Bei!T>uC} zFBkx90H{DcNMCuuUw!&c_w7Y?6n)!$8`HOJe~lBGwH;zd?%T=W1sXfd#<#G2%eEr` z{{db=g!b?I7vBD56=?o!a;AT!fBW#Zzy zEa&5uS1zpsn|E}vF8kDC1P6v~{IvL~kB(lG=#A$=3+~?H2nL=$lfN|Qd>J+r?4ws@ zT7^#T{s^1@nXXR{9AyQz6RlH0Q%hLIA#8HEU;b*-JRG|L@=K}>*2$~J^k)xvK?NB@ z_QSNxDFH{F^{m&<%%*~_^SZ{Z$BCHC&-{3nreqtJurNLxah`Pg+{0a;osL2VBI}Yql zY6c7X>UMc?Q))%7o+zsmfZ;n|^o)hBH97nUX7dJeOX7uq9X1sefwqeE9mU21-&-rp zl&7V)x_=Wt&zxU#-jV>MWvY9}23PWqfK0Lvfd$BnUZyWE@yD1lxxfDmC&m{#bT71| zz`Ea#@dbW~+XtvgjKoU4j!B(%@RhpdP;Avrm*gU*#&H2^5z=jaBDqG8G`GBtRFE_^ zXg3Hj;5=S%t+-PF;B#m810e0^8b%VF0HE!6?!^@Y!-Ek`u_T8$7C?Q_!a17FU}gmq zb+6cVE>C~10U{Lp&$gWr{l6e|6w4cc_`=Bpl`I1XapIE@a7YvIrc6VX@_;A<0LAVC z5;9zA2bGrGKpHcEg%ZX|3!zCZ0%APlTCo@E0r|!Rl<8r^v!>o+Lr?zIx2C;xSI8}| zDA((^kpj|%O5_p@=0H0z$-WZL32m}LUE5}J1#F|i1mK_gyqM-k!ce!e2cCV2b>+i&wS0LS4d2kn)9-qqh5-R^NUehB3IuSX(*A++007Y_uH-mP%9Vz_L&>M9Hxv zQGsK?P{!e$hh|NuEuCm92<~&E+tDGUH33;rW-f%vll7?X4=whcH|B#PAykL-it}iS za{v%%kRXaU40;uLZb>4YjcC(LhLe&FN(Bv42gjG0rR$WQwOyYKiRdh4kT|F5Avtak z?T-*U7yix(|9iQpKoP#)OP|-QNru{&Q1+?V z(Ng+ey`}WA8Xu888(S*U2U5|Nd~7dKp7(wxt@gTH*K7ZJ&zN($&$-X<{{4RUd7er1 z_Hxr3Z891mq$hHB79%u*%Y3ypVI|2t!3%=6Ez4F)#j9h?C6VD|=*BhX(#?`J=4)a@ zNrYnWzslH@+B{{RQ~`5^`zb zo}&Ikjrsx0>=JUG6*hAta#Kh9de~?A);W}&>+2Hk-X;ocZp^=CpyN8<_~bt)PH*nb zZ~Tv-{Dgha`QjZDE^)%-XYFVCzMt=2@iyJ((wKb_UXc-7*>Cty_Pi25$PS2^_}r)Z z>BjBss<@B}vF|#aE(1l(>$O^E!%~y-Up`X0t+Grl<~*!Q+IhwPk;C<#L&}WFkN@31 zzc0D&Xmixn=1%L3x0Qxd9^0nu_~Bh<)70`#g(A?{Bg`i-&3T8b5v+sdUb?@if`GvBn^{NflI#^_2Uu zDo>JDW_`*vP4ACO{FOYj)!AcrlseUi*Y%ssw~vXl8N0`@;N91{bU_a>6W6Usn%4Wd zuVT0FQ_DRrVQ;EO7#uL3_fY5O`uN3*?&vQu(uzJ>*CCs0b~I7g`eQ*z6sN`ddY94R zp!asNajFZJ%SWx5c;jADkPWd*|j? z3;vaubvgQV?mfZkhMe)CEfpoZlI>nNpYo(aU*OwEs_cH3-*EOT5R$FZIc_F=8!L@SXF# zILIW9Y5z( zTV7{nbVoc|n9$dzxzj%}bVdC%WorSoq_oWA8<#Ox50AAtF7WsT+mTk*I*;E(C!@!& zgYAEzAN_D*)vtbIv=yZU{$f*8bkhyb`i3h@xvO3LtQJi*n|(~sF=nzTbZ1^S=7j{?r-8x z5<0Fk&hs^W-d7v(Vya{Ngp0Qh_DAY{-#hv0{hGsWj#WHK#KW3&hlWU2%T~J(pKo%_ z_oY;6zFzx>r=PN$)8hZ;*x*Jcy81MB=SJq6 zILBEdq=~#embt*2>Hjwfgy6MDA%qd45kv%m2oez#A}}IoW|JfkNg|R$Bt|67G$v@M3akMPNCQit z1$$5!umKvd;4sYyVqzE+Nn(7g)e1rbvuQOoMtL1-T?mku)Z0 zkOzJMO*jp9fPNqW3V}6%0cl_fslWpY12#Yd7R@-vY(oqKQxwe@3HqQcL>N<;246ug zuz*d9#uN=cg419C@Pc$O8q|W7;0Mrz(_ja10>PjVSOXZ4hLb=GctBym256dT5t9wu z5W}FMV_+ocgR&4|nr0fPZa>39-BG5W>LxLy)V?$ARa?n$RJ+4;TP>KOtk%FZUrmcq zpsobaa2=paU><0KQfF3p!f!Ovkcz#0kmIvj=pWJu{?g4EDMp&QL!cvZ_lrV^UBY}d z%ER+QV38#idAhKk>acVyM;51bZHA}mnaEkN41U3HeQSu!wKZpV2b!#HXB*C4>~wJU zWKrth`ZKfLf7aM|r_wNX8a2vnU4v?r>5>Zq)J^Q_7&bo~8Q3349ymJOL;xPF@}Vje`cUyNh(ja} z9{iIYFdAOsP&$SuIO3k+mJuiAJ&tmHUW=n9OhLk{(pXJ4za>b{<~J}?jX}bs1{o8{ zV7(zoZJ?U2I{q;IkHz*8>V^zVgQ`9nJSerlWT1H;Iw;jDm( zYmf~yaR_?D65*Mpfu_pYz=kepi bduyrZ$g$!LmF-gIHGxDfUe2eTg5v%Q`MTj6 literal 0 HcmV?d00001 diff --git a/src/layers/legacy/medImageIO/itkDCMTKImageIO.cpp b/src/layers/legacy/medImageIO/itkDCMTKImageIO.cpp index d19b2a48d0..a0dbaf35bc 100644 --- a/src/layers/legacy/medImageIO/itkDCMTKImageIO.cpp +++ b/src/layers/legacy/medImageIO/itkDCMTKImageIO.cpp @@ -54,8 +54,8 @@ DCMTKImageIO::DCMTKImageIO() { this->SetNumberOfDimensions(3); this->SetNumberOfComponents(1); - this->SetPixelType(SCALAR); - this->SetComponentType(CHAR); + this->SetPixelType(IOPixelEnum::SCALAR); + this->SetComponentType(itk::IOComponentEnum::CHAR); DcmRLEDecoderRegistration::registerCodecs(); DJDecoderRegistration::registerCodecs(); @@ -356,11 +356,11 @@ void DCMTKImageIO::DetermineNumberOfPixelComponents() if( samplesPerPixel==1 ) { - this->SetPixelType ( SCALAR ); + this->SetPixelType (itk::IOPixelEnum::SCALAR ); } else { - this->SetPixelType ( RGB ); + this->SetPixelType ( itk::IOPixelEnum::RGB ); } } @@ -373,7 +373,7 @@ void DCMTKImageIO::DeterminePixelType() if (condition.bad()) { - this->SetComponentType(UNKNOWNCOMPONENTTYPE); + this->SetComponentType(itk::IOComponentEnum::UNKNOWNCOMPONENTTYPE); return; } @@ -387,36 +387,36 @@ void DCMTKImageIO::DeterminePixelType() switch( dmp->getRepresentation() ) { case EPR_Uint8: - this->SetComponentType ( UCHAR ); + this->SetComponentType (itk::IOComponentEnum::UCHAR ); break; case EPR_Sint8: - this->SetComponentType ( CHAR ); + this->SetComponentType (itk::IOComponentEnum::CHAR ); break; case EPR_Uint16: - this->SetComponentType ( USHORT ); + this->SetComponentType (itk::IOComponentEnum::USHORT ); break; case EPR_Sint16: - this->SetComponentType ( SHORT ); + this->SetComponentType (itk::IOComponentEnum::SHORT ); break; case EPR_Uint32: - this->SetComponentType ( UINT ); + this->SetComponentType (itk::IOComponentEnum::UINT ); break; case EPR_Sint32: - this->SetComponentType ( INT ); + this->SetComponentType (itk::IOComponentEnum::INT ); break; default: - this->SetComponentType (UNKNOWNCOMPONENTTYPE); + this->SetComponentType (itk::IOComponentEnum::UNKNOWNCOMPONENTTYPE); } } else { - this->SetComponentType (UNKNOWNCOMPONENTTYPE); + this->SetComponentType (itk::IOComponentEnum::UNKNOWNCOMPONENTTYPE); } } } @@ -770,31 +770,31 @@ void DCMTKImageIO::InternalRead (void* buffer, int slice, unsigned long pixelCou size_t length = pixelCount * GetNumberOfComponents(); switch( this->GetComponentType() ) { - case CHAR: + case itk::IOComponentEnum::CHAR: length *= sizeof(char); break; - case UCHAR: + case itk::IOComponentEnum::UCHAR: length *= sizeof(Uint8); break; - case SHORT: + case itk::IOComponentEnum::SHORT: length *= sizeof(Sint16); break; - case USHORT: + case itk::IOComponentEnum::USHORT: length *= sizeof(Uint16); break; - case INT: + case itk::IOComponentEnum::INT: length *= sizeof(Sint32); break; - case UINT: + case itk::IOComponentEnum::UINT: length *= sizeof(Uint32); break; - case DOUBLE: + case itk::IOComponentEnum::DOUBLE: length *= sizeof(Float64); break; diff --git a/src/layers/legacy/medImageIO/itkDataImageReaderBase.cpp b/src/layers/legacy/medImageIO/itkDataImageReaderBase.cpp index 132415e8d2..eeefdf807c 100644 --- a/src/layers/legacy/medImageIO/itkDataImageReaderBase.cpp +++ b/src/layers/legacy/medImageIO/itkDataImageReaderBase.cpp @@ -71,7 +71,7 @@ bool itkDataImageReaderBase::canRead (const QString& path) return false; } - if (this->io->GetPixelType() == itk::ImageIOBase::VECTOR) + if (this->io->GetPixelType() == itk::IOPixelEnum::VECTOR) { return this->io->GetNumberOfComponents() <= 4 ; } @@ -106,7 +106,7 @@ bool itkDataImageReaderBase::readInformation (const QString& path) } medAbstractData *medData = nullptr; - if (this->io->GetPixelType()==itk::ImageIOBase::SCALAR ) + if (this->io->GetPixelType()==itk::IOPixelEnum::SCALAR ) { const int dim = this->io->GetNumberOfDimensions(); if (!(dim>0 && dim<=4)) @@ -119,43 +119,43 @@ bool itkDataImageReaderBase::readInformation (const QString& path) switch (this->io->GetComponentType()) { - case itk::ImageIOBase::UCHAR: + case itk::IOComponentEnum::UCHAR: medData = medAbstractDataFactory::instance()->create(QString("itkDataImageUChar").append(cdim)); break; - case itk::ImageIOBase::CHAR: + case itk::IOComponentEnum::CHAR: medData = medAbstractDataFactory::instance()->create (QString("itkDataImageChar").append(cdim)); break; - case itk::ImageIOBase::USHORT: + case itk::IOComponentEnum::USHORT: medData = medAbstractDataFactory::instance()->create (QString("itkDataImageUShort").append(cdim)); break; - case itk::ImageIOBase::SHORT: + case itk::IOComponentEnum::SHORT: medData = medAbstractDataFactory::instance()->create (QString("itkDataImageShort").append(cdim)); break; - case itk::ImageIOBase::UINT: + case itk::IOComponentEnum::UINT: medData = medAbstractDataFactory::instance()->create (QString("itkDataImageUInt").append(cdim)); break; - case itk::ImageIOBase::INT: + case itk::IOComponentEnum::INT: medData = medAbstractDataFactory::instance()->create (QString("itkDataImageInt").append(cdim)); break; - case itk::ImageIOBase::ULONG: + case itk::IOComponentEnum::ULONG: medData = medAbstractDataFactory::instance()->create (QString("itkDataImageULong").append(cdim)); break; - case itk::ImageIOBase::LONG: + case itk::IOComponentEnum::LONG: medData = medAbstractDataFactory::instance()->create (QString("itkDataImageLong").append(cdim)); break; - case itk::ImageIOBase::FLOAT: + case itk::IOComponentEnum::FLOAT: medData = medAbstractDataFactory::instance()->create (QString("itkDataImageDouble").append(cdim)); // Bug ??? break; - case itk::ImageIOBase::DOUBLE: + case itk::IOComponentEnum::DOUBLE: medData = medAbstractDataFactory::instance()->create (QString("itkDataImageDouble").append(cdim)); // Bug (added 4 which was not existing) ?? break; @@ -164,13 +164,13 @@ bool itkDataImageReaderBase::readInformation (const QString& path) return false; } } - else if (this->io->GetPixelType()==itk::ImageIOBase::RGB) + else if (this->io->GetPixelType()==itk::IOPixelEnum::RGB) { switch (this->io->GetComponentType()) { - case itk::ImageIOBase::UCHAR: + case itk::IOComponentEnum::UCHAR: medData = medAbstractDataFactory::instance()->create ("itkDataImageRGB3"); break; @@ -179,18 +179,18 @@ bool itkDataImageReaderBase::readInformation (const QString& path) return false; } } - else if (this->io->GetPixelType()==itk::ImageIOBase::VECTOR) + else if (this->io->GetPixelType()==itk::IOPixelEnum::VECTOR) { // Added by Theo. switch (this->io->GetComponentType()) { - case itk::ImageIOBase::UCHAR: + case itk::IOComponentEnum::UCHAR: medData = medAbstractDataFactory::instance()->create ("itkDataImageVectorUChar3"); break; - case itk::ImageIOBase::FLOAT: + case itk::IOComponentEnum::FLOAT: medData = medAbstractDataFactory::instance()->create ("itkDataImageVectorFloat3"); break; - case itk::ImageIOBase::DOUBLE: + case itk::IOComponentEnum::DOUBLE: medData = medAbstractDataFactory::instance()->create ("itkDataImageVectorDouble3"); break; default: @@ -198,13 +198,13 @@ bool itkDataImageReaderBase::readInformation (const QString& path) return false; } } - else if ( this->io->GetPixelType()==itk::ImageIOBase::RGBA ) + else if ( this->io->GetPixelType()==itk::IOPixelEnum::RGBA ) { switch (this->io->GetComponentType()) { - case itk::ImageIOBase::UCHAR: + case itk::IOComponentEnum::UCHAR: medData = medAbstractDataFactory::instance()->create ("itkDataImageRGBA3"); break; diff --git a/src/layers/legacy/medImageIO/itkGISImageIO.cpp b/src/layers/legacy/medImageIO/itkGISImageIO.cpp index 38c46badb2..c33fe306a4 100644 --- a/src/layers/legacy/medImageIO/itkGISImageIO.cpp +++ b/src/layers/legacy/medImageIO/itkGISImageIO.cpp @@ -29,16 +29,16 @@ namespace itk { m_IsBinary = true; this->SetNumberOfDimensions(3); - m_PixelType = SCALAR; - m_ComponentType = UCHAR; + m_PixelType = itk::IOPixelEnum::SCALAR; + m_ComponentType = itk::IOComponentEnum::UCHAR; if (ByteSwapper::SystemIsBigEndian()) { - m_ByteOrder = BigEndian; + m_ByteOrder = itk::IOByteOrderEnum::BigEndian; } else { - m_ByteOrder = LittleEndian; + m_ByteOrder = itk::IOByteOrderEnum::LittleEndian; } } @@ -137,13 +137,13 @@ namespace itk //this->SetNumberOfComponents( dims[3] ); this->SetNumberOfComponents( 1 ); //this->SetPixelType (VECTOR); - this->SetPixelType (SCALAR); + this->SetPixelType (itk::IOPixelEnum::SCALAR); } else { this->SetNumberOfDimensions(3); this->SetNumberOfComponents(1); - this->SetPixelType (SCALAR); + this->SetPixelType (itk::IOPixelEnum::SCALAR); } ifs >> junk; @@ -154,7 +154,7 @@ namespace itk dims[3] = 1; this->SetNumberOfDimensions(3); this->SetNumberOfComponents(1); - this->SetPixelType (SCALAR); + this->SetPixelType (itk::IOPixelEnum::SCALAR); } for( unsigned int i=0; iGetNumberOfDimensions(); i++ ) @@ -174,35 +174,35 @@ namespace itk // parse the type if( s_type== "S8" ) { - m_ComponentType = CHAR; + m_ComponentType = itk::IOComponentEnum::CHAR; } else if( s_type== "U8" ) { - m_ComponentType = UCHAR; + m_ComponentType = itk::IOComponentEnum::UCHAR; } else if( s_type== "S16" ) { - m_ComponentType = SHORT; + m_ComponentType = itk::IOComponentEnum::SHORT; } else if( s_type== "U16" ) { - m_ComponentType = USHORT; + m_ComponentType = itk::IOComponentEnum::USHORT; } else if( s_type== "S32" ) { - m_ComponentType = INT; + m_ComponentType = itk::IOComponentEnum::INT; } else if( s_type== "U32" ) { - m_ComponentType = UINT; + m_ComponentType = itk::IOComponentEnum::UINT; } else if( s_type== "F32" || s_type=="FLOAT") { - m_ComponentType = FLOAT; + m_ComponentType = itk::IOComponentEnum::FLOAT; } else if( s_type== "F64" || s_type=="DOUBLE") { - m_ComponentType = DOUBLE; + m_ComponentType = itk::IOComponentEnum::DOUBLE; } else { @@ -261,7 +261,7 @@ namespace itk { // assuming it's LittleEndian //throw itk::ExceptionObject(__FILE__,__LINE__,"Error: Cannot find keyword \"-bo\"."); - m_ByteOrder = LittleEndian; + m_ByteOrder = itk::IOByteOrderEnum::LittleEndian; } else { @@ -269,11 +269,11 @@ namespace itk ifs >> s_byteorder; if( s_byteorder == "DCBA" ) { - m_ByteOrder = LittleEndian; + m_ByteOrder = itk::IOByteOrderEnum::LittleEndian; } else { - m_ByteOrder = BigEndian; + m_ByteOrder = itk::IOByteOrderEnum::BigEndian; } ifs >> junk; } @@ -412,7 +412,7 @@ namespace itk } - if( this->GetNumberOfDimensions()==3 && this->GetPixelType()==SCALAR) + if( this->GetNumberOfDimensions()==3 && this->GetPixelType()== itk::IOPixelEnum::SCALAR) { for( int i=0; i<3; i++ ) { @@ -420,7 +420,7 @@ namespace itk } ofs << "1\n"; } - else if (this->GetNumberOfDimensions()==3 && this->GetPixelType()==VECTOR ) + else if (this->GetNumberOfDimensions()==3 && this->GetPixelType()== itk::IOPixelEnum::VECTOR ) { for( int i=0; i<3; i++ ) { @@ -447,28 +447,28 @@ namespace itk ofs << "-type "; switch (m_ComponentType ) { - case CHAR: + case itk::IOComponentEnum::CHAR: ofs << "S8\n"; break; - case UCHAR: + case itk::IOComponentEnum::UCHAR: ofs << "U8\n"; break; - case SHORT: + case itk::IOComponentEnum::SHORT: ofs << "S16\n"; break; - case USHORT: + case itk::IOComponentEnum::USHORT: ofs << "U16\n"; break; - case INT: + case itk::IOComponentEnum::INT: ofs << "S32\n"; break; - case UINT: + case itk::IOComponentEnum::UINT: ofs << "U32\n"; break; - case FLOAT: + case itk::IOComponentEnum::FLOAT: ofs << "FLOAT\n"; break; - case DOUBLE: + case itk::IOComponentEnum::DOUBLE: ofs << "DOUBLE\n"; break; default: @@ -492,7 +492,7 @@ namespace itk // byte order - if( m_ByteOrder == LittleEndian ) + if( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { ofs << "-bo DCBA\n"; } @@ -519,19 +519,19 @@ namespace itk } - if ( m_PixelType != SCALAR && m_PixelType != VECTOR) + if ( m_PixelType != itk::IOPixelEnum::SCALAR && m_PixelType != itk::IOPixelEnum::VECTOR) { throw ExceptionObject (__FILE__,__LINE__,"Error: GIS only supports SCALAR and VECTOR images."); } - if (m_ComponentType != CHAR && - m_ComponentType != UCHAR && - m_ComponentType != SHORT && - m_ComponentType != USHORT && - m_ComponentType != INT && - m_ComponentType != UINT && - m_ComponentType != FLOAT && - m_ComponentType != DOUBLE) + if (m_ComponentType != itk::IOComponentEnum::CHAR && + m_ComponentType != itk::IOComponentEnum::UCHAR && + m_ComponentType != itk::IOComponentEnum::SHORT && + m_ComponentType != itk::IOComponentEnum::USHORT && + m_ComponentType != itk::IOComponentEnum::INT && + m_ComponentType != itk::IOComponentEnum::UINT && + m_ComponentType != itk::IOComponentEnum::FLOAT && + m_ComponentType != itk::IOComponentEnum::DOUBLE) { throw ExceptionObject (__FILE__,__LINE__,"Error: Pixel type is not supported by GIS format yet."); } @@ -565,7 +565,7 @@ namespace itk const unsigned long numberOfComponents = static_cast( this->GetImageSizeInComponents() ); // Swap bytes if necessary - if ( m_ByteOrder == LittleEndian ) + if ( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { char * tempBuffer = new char[ numberOfBytes ]; memcpy( tempBuffer, buffer , numberOfBytes ); @@ -593,82 +593,82 @@ namespace itk { switch(m_ComponentType) { - case CHAR: + case itk::IOComponentEnum::CHAR: { - if ( m_ByteOrder == LittleEndian ) + if ( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { ByteSwapper::SwapRangeFromSystemToLittleEndian((char*)buffer, numberOfPixels ); } - else if ( m_ByteOrder == BigEndian ) + else if ( m_ByteOrder == itk::IOByteOrderEnum::BigEndian ) { ByteSwapper::SwapRangeFromSystemToBigEndian((char *)buffer, numberOfPixels ); } break; } - case UCHAR: + case itk::IOComponentEnum::UCHAR: { - if ( m_ByteOrder == LittleEndian ) + if ( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { ByteSwapper::SwapRangeFromSystemToLittleEndian( (unsigned char*)buffer, numberOfPixels ); } - else if ( m_ByteOrder == BigEndian ) + else if ( m_ByteOrder == itk::IOByteOrderEnum::BigEndian ) { ByteSwapper::SwapRangeFromSystemToBigEndian( (unsigned char *)buffer, numberOfPixels ); } break; } - case SHORT: + case itk::IOComponentEnum::SHORT: { - if ( m_ByteOrder == LittleEndian ) + if ( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { ByteSwapper::SwapRangeFromSystemToLittleEndian( (short*)buffer, numberOfPixels ); } - else if ( m_ByteOrder == BigEndian ) + else if ( m_ByteOrder == itk::IOByteOrderEnum::BigEndian ) { ByteSwapper::SwapRangeFromSystemToBigEndian( (short *)buffer, numberOfPixels ); } break; } - case USHORT: + case itk::IOComponentEnum::USHORT: { - if ( m_ByteOrder == LittleEndian ) + if ( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { ByteSwapper::SwapRangeFromSystemToLittleEndian( (unsigned short*)buffer, numberOfPixels ); } - else if ( m_ByteOrder == BigEndian ) + else if ( m_ByteOrder == itk::IOByteOrderEnum::BigEndian ) { ByteSwapper::SwapRangeFromSystemToBigEndian( (unsigned short *)buffer, numberOfPixels ); } break; } - case INT: + case itk::IOComponentEnum::INT: { - if ( m_ByteOrder == LittleEndian ) + if ( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { ByteSwapper::SwapRangeFromSystemToLittleEndian( (int*)buffer, numberOfPixels ); } - else if ( m_ByteOrder == BigEndian ) + else if ( m_ByteOrder == itk::IOByteOrderEnum::BigEndian ) { ByteSwapper::SwapRangeFromSystemToBigEndian( (int*)buffer, numberOfPixels ); } break; } - case UINT: + case itk::IOComponentEnum::UINT: { - if ( m_ByteOrder == LittleEndian ) + if ( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { ByteSwapper::SwapRangeFromSystemToLittleEndian( (unsigned int*)buffer, numberOfPixels ); } - else if ( m_ByteOrder == BigEndian ) + else if ( m_ByteOrder == itk::IOByteOrderEnum::BigEndian ) { ByteSwapper::SwapRangeFromSystemToBigEndian( (unsigned int *)buffer, numberOfPixels ); @@ -676,28 +676,28 @@ namespace itk break; } - case FLOAT: + case itk::IOComponentEnum::FLOAT: { - if ( m_ByteOrder == LittleEndian ) + if ( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { ByteSwapper::SwapRangeFromSystemToLittleEndian( (float*)buffer, numberOfPixels ); } - else if ( m_ByteOrder == BigEndian ) + else if ( m_ByteOrder == itk::IOByteOrderEnum::BigEndian ) { ByteSwapper::SwapRangeFromSystemToBigEndian( (float *)buffer, numberOfPixels ); } break; } - case DOUBLE: + case itk::IOComponentEnum::DOUBLE: { - if ( m_ByteOrder == LittleEndian ) + if ( m_ByteOrder == itk::IOByteOrderEnum::LittleEndian ) { ByteSwapper::SwapRangeFromSystemToLittleEndian( (double*)buffer, numberOfPixels ); } - else if ( m_ByteOrder == BigEndian ) + else if ( m_ByteOrder == itk::IOByteOrderEnum::BigEndian ) { ByteSwapper::SwapRangeFromSystemToBigEndian( (double *)buffer, numberOfPixels ); diff --git a/src/layers/legacy/medImageIO/itkMultiThreadedImageIOBase.cpp b/src/layers/legacy/medImageIO/itkMultiThreadedImageIOBase.cpp index 37e278c109..7fb5735011 100644 --- a/src/layers/legacy/medImageIO/itkMultiThreadedImageIOBase.cpp +++ b/src/layers/legacy/medImageIO/itkMultiThreadedImageIOBase.cpp @@ -18,7 +18,8 @@ namespace itk { - + itkEventMacroDefinition(SliceReadEvent, itk::AnyEvent); + MultiThreadedImageIOBase::MultiThreadedImageIOBase() : m_NumberOfThreads(0) { diff --git a/src/layers/legacy/medImageIO/itkMultiThreadedImageIOBase.h b/src/layers/legacy/medImageIO/itkMultiThreadedImageIOBase.h index 2b67e700b6..c2be7ffb9e 100644 --- a/src/layers/legacy/medImageIO/itkMultiThreadedImageIOBase.h +++ b/src/layers/legacy/medImageIO/itkMultiThreadedImageIOBase.h @@ -78,5 +78,5 @@ namespace itk }; - itkEventMacro (SliceReadEvent, AnyEvent) + itkEventMacroDeclaration(SliceReadEvent, itk::AnyEvent); } // end of namespace diff --git a/src/layers/legacy/medImageIO/medInrimageImageIO.cpp b/src/layers/legacy/medImageIO/medInrimageImageIO.cpp index ad332e19f9..e8f433d8d4 100644 --- a/src/layers/legacy/medImageIO/medInrimageImageIO.cpp +++ b/src/layers/legacy/medImageIO/medInrimageImageIO.cpp @@ -13,7 +13,7 @@ =========================================================================*/ #include "medInrimageImageIO.h" -#include +#include #include #include @@ -136,13 +136,13 @@ InrimageImageIO::InrimageImageIO() // pixel type is UCHAR // m_PixelType is a protected member of ImageIOBase (IODataType itk::ImageIOBase::m_PixelType) - this->SetPixelType(SCALAR); + this->SetPixelType(itk::IOPixelEnum::SCALAR); this->SetNumberOfComponents(1); - this->SetComponentType(DOUBLE); + this->SetComponentType(itk::IOComponentEnum::DOUBLE); // Byte order - this->SetByteOrder((itk::ByteSwapper::SystemIsBigEndian() == true) ? BigEndian : LittleEndian); + this->SetByteOrder((itk::ByteSwapper::SystemIsBigEndian() == true) ? itk::IOByteOrderEnum::BigEndian : itk::IOByteOrderEnum::LittleEndian); // additionnal information // (inrimage only) @@ -171,30 +171,30 @@ void InrimageImageIO::PrintSelf(std::ostream& os, itk::Indent indent) const os << indent << "PixelType " << m_PixelType << std::endl; } -const std::type_info& InrimageImageIO::ConvertToTypeInfo(IOPixelType t) const +const std::type_info& InrimageImageIO::ConvertToTypeInfo(itk::IOComponentEnum t) const { switch (t) { - case UCHAR: + case itk::IOComponentEnum::UCHAR: return typeid(unsigned char); - case CHAR: + case itk::IOComponentEnum::CHAR: return typeid(char); - case USHORT: + case itk::IOComponentEnum::USHORT: return typeid(unsigned short); - case SHORT: + case itk::IOComponentEnum::SHORT: return typeid(short); - case UINT: + case itk::IOComponentEnum::UINT: return typeid(unsigned int); - case INT: + case itk::IOComponentEnum::INT: return typeid(int); - case ULONG: + case itk::IOComponentEnum::ULONG: return typeid(unsigned long); - case LONG: + case itk::IOComponentEnum::LONG: return typeid(long); - case FLOAT: + case itk::IOComponentEnum::FLOAT: return typeid(float); - case DOUBLE: + case itk::IOComponentEnum::DOUBLE: return typeid(double); /*case RGB: return typeid(RGBPixel); @@ -204,7 +204,7 @@ const std::type_info& InrimageImageIO::ConvertToTypeInfo(IOPixelType t) const default: itkExceptionMacro("Invalid type: " << m_PixelType); } - return typeid(ImageIOBase::UNKNOWNPIXELTYPE); + return typeid(itk::IOComponentEnum::UNKNOWNCOMPONENTTYPE); } @@ -653,10 +653,10 @@ void InrimageImageIO::ReadImageInformation() } if (std::string(type, 0, strlen("unsigned")).compare("unsigned") == 0) { - if (pixsize == 8) this->SetComponentType(UCHAR); - else if (pixsize == 16) this->SetComponentType(USHORT); - else if (pixsize == 32) this->SetComponentType(UINT); - else if (pixsize == 64) this->SetComponentType(ULONG); + if (pixsize == 8) this->SetComponentType(itk::IOComponentEnum::UCHAR); + else if (pixsize == 16) this->SetComponentType(itk::IOComponentEnum::USHORT); + else if (pixsize == 32) this->SetComponentType(itk::IOComponentEnum::UINT); + else if (pixsize == 64) this->SetComponentType(itk::IOComponentEnum::ULONG); else { itk::ExceptionObject exception(__FILE__, __LINE__); exception.SetDescription("Pixel Size Not Recognized"); @@ -664,10 +664,10 @@ void InrimageImageIO::ReadImageInformation() } } else if (std::string(type, 0, strlen("signed")).compare("signed") == 0) { - if (pixsize == 8) this->SetComponentType(CHAR); - else if (pixsize == 16) this->SetComponentType(SHORT); - else if (pixsize == 32) this->SetComponentType(INT); - else if (pixsize == 64) this->SetComponentType(LONG); + if (pixsize == 8) this->SetComponentType(itk::IOComponentEnum::CHAR); + else if (pixsize == 16) this->SetComponentType(itk::IOComponentEnum::SHORT); + else if (pixsize == 32) this->SetComponentType(itk::IOComponentEnum::INT); + else if (pixsize == 64) this->SetComponentType(itk::IOComponentEnum::LONG); else { itk::ExceptionObject exception(__FILE__, __LINE__); exception.SetDescription("Pixel Size Not Recognized"); @@ -675,8 +675,8 @@ void InrimageImageIO::ReadImageInformation() } } else if (std::string(type, 0, strlen("float")).compare("float") == 0) { - if (pixsize == 32) this->SetComponentType(FLOAT); - else if (pixsize == 64) this->SetComponentType(DOUBLE); + if (pixsize == 32) this->SetComponentType(itk::IOComponentEnum::FLOAT); + else if (pixsize == 64) this->SetComponentType(itk::IOComponentEnum::DOUBLE); else { itk::ExceptionObject exception(__FILE__, __LINE__); exception.SetDescription("Pixel Size Not Recognized"); @@ -684,7 +684,7 @@ void InrimageImageIO::ReadImageInformation() } } - this->SetPixelType(SCALAR); + this->SetPixelType(itk::IOPixelEnum::SCALAR); if (0) { std::cout << "type " << type << std::endl; @@ -712,8 +712,8 @@ void InrimageImageIO::ReadImageInformation() switch (this->GetComponentType()) { default: break; - case UCHAR: - this->SetPixelType(RGB); + case itk::IOComponentEnum::UCHAR: + this->SetPixelType(itk::IOPixelEnum::RGB); this->SetNumberOfComponents(1); break; } @@ -722,8 +722,8 @@ void InrimageImageIO::ReadImageInformation() switch (this->GetComponentType()) { default: break; - case UCHAR: - this->SetPixelType(RGBA); + case itk::IOComponentEnum::UCHAR: + this->SetPixelType(itk::IOPixelEnum::RGBA); this->SetNumberOfComponents(1); break; } @@ -839,24 +839,24 @@ ::Write(const void* buffer) char scale[20]; switch (this->GetComponentType()) { - case UCHAR: - case USHORT: - case UINT: - case ULONG: + case itk::IOComponentEnum::UCHAR: + case itk::IOComponentEnum::USHORT: + case itk::IOComponentEnum::UINT: + case itk::IOComponentEnum::ULONG: type = "unsigned fixed"; sprintf(scale, "SCALE=2**0\n"); break; - case CHAR: - case SHORT: - case INT: - case LONG: + case itk::IOComponentEnum::CHAR: + case itk::IOComponentEnum::SHORT: + case itk::IOComponentEnum::INT: + case itk::IOComponentEnum::LONG: type = "signed fixed"; sprintf(scale, "SCALE=2**0\n"); break; - case FLOAT: - case DOUBLE: + case itk::IOComponentEnum::FLOAT: + case itk::IOComponentEnum::DOUBLE: type = "float"; scale[0] = '\0'; break; @@ -869,25 +869,25 @@ ::Write(const void* buffer) int pixsize = 8; switch (this->GetComponentType()) { - case UCHAR: - case CHAR: + case itk::IOComponentEnum::UCHAR: + case itk::IOComponentEnum::CHAR: pixsize = 8; break; - case USHORT: - case SHORT: + case itk::IOComponentEnum::USHORT: + case itk::IOComponentEnum::SHORT: pixsize = 16; break; - case UINT: - case INT: - case FLOAT: + case itk::IOComponentEnum::UINT: + case itk::IOComponentEnum::INT: + case itk::IOComponentEnum::FLOAT: pixsize = 32; break; - case ULONG: - case LONG: - case DOUBLE: + case itk::IOComponentEnum::ULONG: + case itk::IOComponentEnum::LONG: + case itk::IOComponentEnum::DOUBLE: pixsize = 64; break; @@ -897,7 +897,7 @@ ::Write(const void* buffer) } std::string endianness; - if (this->GetByteOrder() == LittleEndian) + if (this->GetByteOrder() == itk::IOByteOrderEnum::LittleEndian) endianness = "decm"; else endianness = "sun"; @@ -1043,47 +1043,47 @@ ::Write(const void* buffer) void InrimageImageIO::SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels) { - if (ImageIOBase::GetByteOrder() == LittleEndian) + if (ImageIOBase::GetByteOrder() == itk::IOByteOrderEnum::LittleEndian) { - switch (m_PixelType) + switch (m_ComponentType) { - case CHAR: + case itk::IOComponentEnum::CHAR: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian((char*)buffer, numberOfPixels); break; - case UCHAR: + case itk::IOComponentEnum::UCHAR: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian ((unsigned char*)buffer, numberOfPixels); break; - case SHORT: + case itk::IOComponentEnum::SHORT: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian ((short*)buffer, numberOfPixels); break; - case USHORT: + case itk::IOComponentEnum::USHORT: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian ((unsigned short*)buffer, numberOfPixels); break; - case INT: + case itk::IOComponentEnum::INT: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian ((int*)buffer, numberOfPixels); break; - case UINT: + case itk::IOComponentEnum::UINT: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian ((unsigned int*)buffer, numberOfPixels); break; - case LONG: + case itk::IOComponentEnum::LONG: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian ((long*)buffer, numberOfPixels); break; - case ULONG: + case itk::IOComponentEnum::ULONG: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian ((unsigned long*)buffer, numberOfPixels); break; - case FLOAT: + case itk::IOComponentEnum::FLOAT: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian((float*)buffer, numberOfPixels); break; - case DOUBLE: + case itk::IOComponentEnum::DOUBLE: itk::ByteSwapper::SwapRangeFromSystemToLittleEndian ((double*)buffer, numberOfPixels); break; @@ -1095,45 +1095,45 @@ void InrimageImageIO::SwapBytesIfNecessary(void* buffer, unsigned long numberOfP } else { - switch (m_PixelType) + switch (m_ComponentType) { - case CHAR: + case itk::IOComponentEnum::CHAR: itk::ByteSwapper::SwapRangeFromSystemToBigEndian((char *)buffer, numberOfPixels); break; - case UCHAR: + case itk::IOComponentEnum::UCHAR: itk::ByteSwapper::SwapRangeFromSystemToBigEndian ((unsigned char *)buffer, numberOfPixels); break; - case SHORT: + case itk::IOComponentEnum::SHORT: itk::ByteSwapper::SwapRangeFromSystemToBigEndian ((short *)buffer, numberOfPixels); break; - case USHORT: + case itk::IOComponentEnum::USHORT: itk::ByteSwapper::SwapRangeFromSystemToBigEndian ((unsigned short *)buffer, numberOfPixels); break; - case INT: + case itk::IOComponentEnum::INT: itk::ByteSwapper::SwapRangeFromSystemToBigEndian ((int *)buffer, numberOfPixels); break; - case UINT: + case itk::IOComponentEnum::UINT: itk::ByteSwapper::SwapRangeFromSystemToBigEndian ((unsigned int *)buffer, numberOfPixels); break; - case LONG: + case itk::IOComponentEnum::LONG: itk::ByteSwapper::SwapRangeFromSystemToBigEndian ((long *)buffer, numberOfPixels); break; - case ULONG: + case itk::IOComponentEnum::ULONG: itk::ByteSwapper::SwapRangeFromSystemToBigEndian ((unsigned long *)buffer, numberOfPixels); break; - case FLOAT: + case itk::IOComponentEnum::FLOAT: itk::ByteSwapper::SwapRangeFromSystemToBigEndian ((float *)buffer, numberOfPixels); break; - case DOUBLE: + case itk::IOComponentEnum::DOUBLE: itk::ByteSwapper::SwapRangeFromSystemToBigEndian ((double *)buffer, numberOfPixels); break; diff --git a/src/layers/legacy/medImageIO/medInrimageImageIO.h b/src/layers/legacy/medImageIO/medInrimageImageIO.h index 58eddcc08c..f6d3e2965a 100644 --- a/src/layers/legacy/medImageIO/medInrimageImageIO.h +++ b/src/layers/legacy/medImageIO/medInrimageImageIO.h @@ -71,7 +71,7 @@ class MEDIMAGEIO_EXPORT InrimageImageIO : public itk::ImageIOBase virtual void ReadImageInformation(); /** Convert to type_info */ - const std::type_info& ConvertToTypeInfo(IOPixelType) const; + const std::type_info& ConvertToTypeInfo(itk::IOComponentEnum) const; /** Reads the data from disk into the memory buffer provided. */ virtual void Read(void* buffer); diff --git a/src/layers/legacy/medUtilities/CMakeLists.txt b/src/layers/legacy/medUtilities/CMakeLists.txt index 854243aad9..61d4ee6bb7 100644 --- a/src/layers/legacy/medUtilities/CMakeLists.txt +++ b/src/layers/legacy/medUtilities/CMakeLists.txt @@ -25,7 +25,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(VTK REQUIRED COMPONENTS vtkInteractionWidgets ) include(${VTK_USE_FILE}) -find_package(ITK REQUIRED COMPONENTS ITKCommon ITKIOGDCM ITKThresholding) +find_package(ITK REQUIRED COMPONENTS ITKCommon ITKGDCM ITKIOGDCM ITKThresholding) include(${ITK_USE_FILE}) if (ITK_USE_SYSTEM_GDCM) diff --git a/src/plugins/legacy/LCCLogDemons/CMakeLists.txt b/src/plugins/legacy/LCCLogDemons/CMakeLists.txt index f9fda1b3ea..59c8a0373d 100644 --- a/src/plugins/legacy/LCCLogDemons/CMakeLists.txt +++ b/src/plugins/legacy/LCCLogDemons/CMakeLists.txt @@ -98,6 +98,7 @@ SET(ITKIO_LIBRARIES target_link_libraries(${TARGET_NAME} ${ITKIO_LIBRARIES} + ITKPDEDeformableRegistration Qt5::Core dtkLog dtkCoreSupport diff --git a/src/plugins/legacy/diffeomorphicDemons/CMakeLists.txt b/src/plugins/legacy/diffeomorphicDemons/CMakeLists.txt index cb9ca6a237..698e4c4598 100644 --- a/src/plugins/legacy/diffeomorphicDemons/CMakeLists.txt +++ b/src/plugins/legacy/diffeomorphicDemons/CMakeLists.txt @@ -88,6 +88,7 @@ target_link_libraries(${TARGET_NAME} dtkCore dtkLog ITKCommon + ITKPDEDeformableRegistration medCore medRegistration ) diff --git a/src/plugins/legacy/itkDataDiffusionGradientList/CMakeLists.txt b/src/plugins/legacy/itkDataDiffusionGradientList/CMakeLists.txt index 6ce7e70c57..c68bc0fcaf 100644 --- a/src/plugins/legacy/itkDataDiffusionGradientList/CMakeLists.txt +++ b/src/plugins/legacy/itkDataDiffusionGradientList/CMakeLists.txt @@ -35,9 +35,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(TTK REQUIRED) -include(${TTK_USE_FILE}) - +find_package(TTK REQUIRED COMPONENTS ITKTensor) ## ############################################################################# ## List Sources @@ -91,7 +89,7 @@ target_link_libraries(${TARGET_NAME} ${QT_LIBRARIES} dtkLog dtkCore - ITKTensor + TTK::ITKTensor medCore medLog ) diff --git a/src/plugins/legacy/itkDataImage/CMakeLists.txt b/src/plugins/legacy/itkDataImage/CMakeLists.txt index d40884c0a0..b89ba131a9 100644 --- a/src/plugins/legacy/itkDataImage/CMakeLists.txt +++ b/src/plugins/legacy/itkDataImage/CMakeLists.txt @@ -50,7 +50,7 @@ set(ITK_IMAGES_DEPENDENCIES ITKIOPhilipsREC ) -find_package(ITK REQUIRED COMPONENTS ITKIOImageBase ITKIOGDCM ITKIOVTK ITKVtkGlue ${ITK_IMAGES_DEPENDENCIES}) +find_package(ITK REQUIRED COMPONENTS ITKIOImageBase ITKGDCM ITKIOGDCM ITKIOVTK ITKVtkGlue ${ITK_IMAGES_DEPENDENCIES}) include(${ITK_USE_FILE}) # itkLogForwarder used through medLog @@ -137,7 +137,8 @@ target_link_libraries(${TARGET_NAME} Qt5::Widgets dtkCore dtkLog - ITKStatistics + gdcmCommon + ${ITK_LIBRARIES} medCore medImageIO medLog diff --git a/src/plugins/legacy/itkDataImage/readers/itkDCMTKDataImageReader.cpp b/src/plugins/legacy/itkDataImage/readers/itkDCMTKDataImageReader.cpp index f68f5b4143..2f7cf197e0 100644 --- a/src/plugins/legacy/itkDataImage/readers/itkDCMTKDataImageReader.cpp +++ b/src/plugins/legacy/itkDataImage/readers/itkDCMTKDataImageReader.cpp @@ -19,6 +19,8 @@ #include +#include +#include #include #include #include @@ -301,42 +303,42 @@ bool itkDCMTKDataImageReader::readInformation(const QStringList& paths) std::ostringstream imagetypestring; imagetypestring << "itkDataImage"; - if (d->io->GetPixelType() == itk::ImageIOBase::SCALAR) + if (d->io->GetPixelType() == itk::IOPixelEnum::SCALAR) { switch (d->io->GetComponentType()) { - case itk::ImageIOBase::UCHAR: + case itk::IOComponentEnum::UCHAR: imagetypestring << "UChar"; break; - case itk::ImageIOBase::CHAR: + case itk::IOComponentEnum::CHAR: imagetypestring << "Char"; break; - case itk::ImageIOBase::USHORT: + case itk::IOComponentEnum::USHORT: imagetypestring << "UShort"; break; - case itk::ImageIOBase::SHORT: + case itk::IOComponentEnum::SHORT: imagetypestring << "Short"; break; - case itk::ImageIOBase::UINT: + case itk::IOComponentEnum::UINT: imagetypestring << "UInt"; break; - case itk::ImageIOBase::INT: + case itk::IOComponentEnum::INT: imagetypestring << "Int"; break; - case itk::ImageIOBase::ULONG: + case itk::IOComponentEnum::ULONG: imagetypestring << "ULong"; break; - case itk::ImageIOBase::LONG: + case itk::IOComponentEnum::LONG: imagetypestring << "Long"; break; - case itk::ImageIOBase::FLOAT: + case itk::IOComponentEnum::FLOAT: imagetypestring << "Float"; break; - case itk::ImageIOBase::DOUBLE: + case itk::IOComponentEnum::DOUBLE: imagetypestring << "Double"; break; default: - qDebug() << "Unrecognized component type: " << d->io->GetComponentType(); + qDebug() << "Unrecognized component type: " << static_cast(d->io->GetComponentType()); return false; } @@ -345,12 +347,12 @@ bool itkDCMTKDataImageReader::readInformation(const QStringList& paths) if (medData) this->setData(medData); } - else if (d->io->GetPixelType() == itk::ImageIOBase::RGB) + else if (d->io->GetPixelType() == itk::IOPixelEnum::RGB) { switch (d->io->GetComponentType()) { - case itk::ImageIOBase::UCHAR: + case itk::IOComponentEnum::UCHAR: medData = medAbstractDataFactory::instance()->create("itkDataImageRGB3"); if (medData) diff --git a/src/plugins/legacy/itkDataImage/readers/itkGDCMDataImageReader.cpp b/src/plugins/legacy/itkDataImage/readers/itkGDCMDataImageReader.cpp index f3231825e9..984be7b43d 100644 --- a/src/plugins/legacy/itkDataImage/readers/itkGDCMDataImageReader.cpp +++ b/src/plugins/legacy/itkDataImage/readers/itkGDCMDataImageReader.cpp @@ -31,6 +31,8 @@ #include +#include + #include const char itkGDCMDataImageReader::ID[] = "itkGDCMDataImageReader"; @@ -279,7 +281,7 @@ bool itkGDCMDataImageReader::readInformation(const QStringList &paths) std::ostringstream imagetypestring; imagetypestring << "itkDataImage"; - if (d->io->GetPixelType() != itk::ImageIOBase::SCALAR) + if (d->io->GetPixelType() != itk::IOPixelEnum::SCALAR) { dtkDebug() << "Unsupported pixel type"; return false; @@ -287,34 +289,34 @@ bool itkGDCMDataImageReader::readInformation(const QStringList &paths) switch (d->io->GetComponentType()) { - case itk::ImageIOBase::UCHAR: + case itk::IOComponentEnum::UCHAR: imagetypestring << "UChar"; break; - case itk::ImageIOBase::CHAR: + case itk::IOComponentEnum::CHAR: imagetypestring << "Char"; break; - case itk::ImageIOBase::USHORT: + case itk::IOComponentEnum::USHORT: imagetypestring << "UShort"; break; - case itk::ImageIOBase::SHORT: + case itk::IOComponentEnum::SHORT: imagetypestring << "Short"; break; - case itk::ImageIOBase::UINT: + case itk::IOComponentEnum::UINT: imagetypestring << "UInt"; break; - case itk::ImageIOBase::INT: + case itk::IOComponentEnum::INT: imagetypestring << "Int"; break; - case itk::ImageIOBase::ULONG: + case itk::IOComponentEnum::ULONG: imagetypestring << "ULong"; break; - case itk::ImageIOBase::LONG: + case itk::IOComponentEnum::LONG: imagetypestring << "Long"; break; - case itk::ImageIOBase::FLOAT: + case itk::IOComponentEnum::FLOAT: imagetypestring << "Float"; break; - case itk::ImageIOBase::DOUBLE: + case itk::IOComponentEnum::DOUBLE: /** @todo Handle properly double pixel values. For the moment it is only handled in 3D, not in 4D, and it is very @@ -328,14 +330,14 @@ bool itkGDCMDataImageReader::readInformation(const QStringList &paths) imagetypestring << "Double"; break; default: - dtkDebug() << "Unrecognized component type:\t " << d->io->GetComponentType(); + qDebug() << "Unrecognized component type:\t " << static_cast(d->io->GetComponentType()); return false; } imagetypestring << imagedimension; if (imagedimension == 4) { - dtkDebug() << "image type given :\t" << imagetypestring.str().c_str(); + qDebug() << "image type given :\t" << imagetypestring.str().c_str(); } medData = medAbstractDataFactory::instance()->createSmartPointer(imagetypestring.str().c_str()); diff --git a/src/plugins/legacy/itkDataSHImage/readers/itkDataSHImageReader.cpp b/src/plugins/legacy/itkDataSHImage/readers/itkDataSHImageReader.cpp index e37fd99789..c47c08cecf 100644 --- a/src/plugins/legacy/itkDataSHImage/readers/itkDataSHImageReader.cpp +++ b/src/plugins/legacy/itkDataSHImage/readers/itkDataSHImageReader.cpp @@ -70,8 +70,7 @@ bool itkDataSHImageReader::canRead (const QStringList &paths) bool itkDataSHImageReader::canRead (const QString &path) { - itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(path.toUtf8().constData(), - itk::ImageIOFactory::ReadMode); + itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(path.toLatin1().constData(), itk::IOFileModeEnum::ReadMode); if (!imageIO.IsNull()) { @@ -114,8 +113,7 @@ bool itkDataSHImageReader::readInformation (const QStringList &paths) bool itkDataSHImageReader::readInformation (const QString &path) { - itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(path.toUtf8().constData(), - itk::ImageIOFactory::ReadMode); + itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(path.toLatin1().constData(), itk::IOFileModeEnum::ReadMode); imageIO->SetFileName ( path.toUtf8().constData() ); try @@ -133,13 +131,13 @@ bool itkDataSHImageReader::readInformation (const QString &path) if (!medData) { switch (imageIO->GetComponentType()) { - case itk::ImageIOBase::FLOAT: + case itk::IOComponentEnum::FLOAT: medData = medAbstractDataFactory::instance()->create ("itkDataSHImageFloat3"); if (medData) this->setData ( medData ); break; - case itk::ImageIOBase::DOUBLE: + case itk::IOComponentEnum::DOUBLE: medData = medAbstractDataFactory::instance()->create ("itkDataSHImageDouble3"); if (medData) this->setData ( medData ); diff --git a/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt b/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt index 19e6f0e6e0..33ae107785 100644 --- a/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt +++ b/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt @@ -38,9 +38,7 @@ include(${ITK_USE_FILE}) find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonExecutionModel vtkRenderingCore vtkImagingCore vtkInteractionStyle vtkInteractionWidgets) include(${VTK_USE_FILE}) -find_package(TTK REQUIRED) -include(${TTK_USE_FILE}) - +find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) ## ############################################################################# ## List Sources @@ -118,7 +116,8 @@ target_link_libraries(${TARGET_NAME} ITKIOPNG ITKIOStimulate ITKIOVTK - ITKTensor + TTK::ITKTensor + TTK::ttkAlgorithms medCore medLog medVtkInria diff --git a/src/plugins/legacy/itkDataTensorImage/readers/itkDataTensorImageReaderBase.cpp b/src/plugins/legacy/itkDataTensorImage/readers/itkDataTensorImageReaderBase.cpp index d7f60cded2..b5e74d0c2b 100644 --- a/src/plugins/legacy/itkDataTensorImage/readers/itkDataTensorImageReaderBase.cpp +++ b/src/plugins/legacy/itkDataTensorImage/readers/itkDataTensorImageReaderBase.cpp @@ -109,13 +109,13 @@ bool itkDataTensorImageReaderBase::readInformation (const QString &path) switch (this->io->GetComponentType()) { - case itk::ImageIOBase::FLOAT: + case itk::IOComponentEnum::FLOAT: medData = medAbstractDataFactory::instance()->create ("itkDataTensorImageFloat3"); if (medData) this->setData ( medData ); break; - case itk::ImageIOBase::DOUBLE: + case itk::IOComponentEnum::DOUBLE: medData = medAbstractDataFactory::instance()->create ("itkDataTensorImageDouble3"); if (medData) this->setData ( medData ); diff --git a/src/plugins/legacy/itkFilters/CMakeLists.txt b/src/plugins/legacy/itkFilters/CMakeLists.txt index e6f29f527f..63503dbda8 100644 --- a/src/plugins/legacy/itkFilters/CMakeLists.txt +++ b/src/plugins/legacy/itkFilters/CMakeLists.txt @@ -34,7 +34,7 @@ find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKThresholding ITKConnectedComponents - ITKSmoothing ITKBinaryMathematicalMorphology) + ITKSmoothing ITKBinaryMathematicalMorphology ITKMathematicalMorphology) include(${ITK_USE_FILE}) ## ############################################################################# @@ -75,6 +75,8 @@ target_link_libraries(${TARGET_NAME} dtkCore dtkLog ITKCommon + ITKSmoothing + ITKMathematicalMorphology medCore medUtilities ) diff --git a/src/plugins/legacy/itkProcessRegistrationOptimus/CMakeLists.txt b/src/plugins/legacy/itkProcessRegistrationOptimus/CMakeLists.txt index 82546fbdcf..399c1daa17 100644 --- a/src/plugins/legacy/itkProcessRegistrationOptimus/CMakeLists.txt +++ b/src/plugins/legacy/itkProcessRegistrationOptimus/CMakeLists.txt @@ -98,6 +98,7 @@ target_link_libraries(${TARGET_NAME} medCoreLegacy ${ITKIO_LIBRARIES} ITKOptimizers + ITKSmoothing medRegistration ) diff --git a/src/plugins/legacy/medAlgorithmPaint/CMakeLists.txt b/src/plugins/legacy/medAlgorithmPaint/CMakeLists.txt index 62865cfb72..2628424008 100644 --- a/src/plugins/legacy/medAlgorithmPaint/CMakeLists.txt +++ b/src/plugins/legacy/medAlgorithmPaint/CMakeLists.txt @@ -72,6 +72,7 @@ add_library(${TARGET_NAME} SHARED target_link_libraries(${TARGET_NAME} ${QT_LIBRARIES} ITKCommon + ITKRegionGrowing medCore medUtilities ) diff --git a/src/plugins/legacy/medAlgorithmPaint/medAlgorithmPaintToolBox.cpp b/src/plugins/legacy/medAlgorithmPaint/medAlgorithmPaintToolBox.cpp index 9fbfd66239..670c41ec18 100644 --- a/src/plugins/legacy/medAlgorithmPaint/medAlgorithmPaintToolBox.cpp +++ b/src/plugins/legacy/medAlgorithmPaint/medAlgorithmPaintToolBox.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/plugins/legacy/medCompositeDataSets/CMakeLists.txt b/src/plugins/legacy/medCompositeDataSets/CMakeLists.txt index 50e950063e..97705b5018 100644 --- a/src/plugins/legacy/medCompositeDataSets/CMakeLists.txt +++ b/src/plugins/legacy/medCompositeDataSets/CMakeLists.txt @@ -35,8 +35,7 @@ find_package(dtk REQUIRED) include(${dtk_USE_FILE}) include(dtkPlugin) -find_package(TTK REQUIRED) -include(${TTK_USE_FILE}) +find_package(TTK REQUIRED COMPONENTS ITKTensor) ## ################################################################# ## Input @@ -71,7 +70,7 @@ target_link_libraries(${PROJECT_NAME} dtkCore dtkLog dtkZip - ITKTensor + TTK::ITKTensor ITKCommon medCore medGui diff --git a/src/plugins/legacy/medSegmentation/CMakeLists.txt b/src/plugins/legacy/medSegmentation/CMakeLists.txt index 6b82ec3cad..61759885c4 100644 --- a/src/plugins/legacy/medSegmentation/CMakeLists.txt +++ b/src/plugins/legacy/medSegmentation/CMakeLists.txt @@ -92,8 +92,8 @@ add_library(${TARGET_NAME} SHARED target_link_libraries(${TARGET_NAME} ${QT_LIBRARIES} dtkCore - dtkLog - ITKCommon + dtkLog + ${ITK_LIBRARIES} medCore medVtkInria medImageIO diff --git a/src/plugins/legacy/medVtkFibersData/CMakeLists.txt b/src/plugins/legacy/medVtkFibersData/CMakeLists.txt index a826a7f5af..216b17baf7 100644 --- a/src/plugins/legacy/medVtkFibersData/CMakeLists.txt +++ b/src/plugins/legacy/medVtkFibersData/CMakeLists.txt @@ -38,8 +38,7 @@ include(${VTK_USE_FILE}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKVtkGlue) include(${ITK_USE_FILE}) -find_package(TTK REQUIRED) -include(${TTK_USE_FILE}) +find_package(TTK REQUIRED COMPONENTS ttkAlgorithms ITKTensor) ## ############################################################################# ## List Sources @@ -106,7 +105,8 @@ target_link_libraries(${TARGET_NAME} medCore medLog medVtkInria - ttkAlgorithms + TTK::ttkAlgorithms + TTK::ITKTensor ITKCommon ITKVtkGlue ) diff --git a/src/plugins/legacy/polygonRoi/toolboxes/defaultLabelToolBox.cpp b/src/plugins/legacy/polygonRoi/toolboxes/defaultLabelToolBox.cpp index 2875f91def..b16718bfd2 100644 --- a/src/plugins/legacy/polygonRoi/toolboxes/defaultLabelToolBox.cpp +++ b/src/plugins/legacy/polygonRoi/toolboxes/defaultLabelToolBox.cpp @@ -1,6 +1,7 @@ #include "defaultLabelToolBox.h" #include +#include #include #include #include @@ -34,11 +35,36 @@ defaultLabelToolBox::defaultLabelToolBox(QWidget *parent): labels->setContentsMargins(0,0,0,0); labels->setObjectName("labels"); - plusButton = new QPushButton(QIcon(":/pixmaps/plus.png"), ""); + // Themes + QVariant themeChosen = medSettingsManager::instance().value("startup","theme"); + int themeIndex = themeChosen.toInt(); + QIcon labelIconPlus; + QIcon labelIconMinus; + switch (themeIndex) + { + case 0: + case 1: + case 2: + case 4: + default: + { + labelIconPlus = QIcon(":/pixmaps/plus_white.png"); + labelIconMinus = QIcon(":/pixmaps/minus_white.png"); + break; + } + case 3: + { + labelIconPlus = QIcon(":/pixmaps/plus_black.png"); + labelIconMinus = QIcon(":/pixmaps/minus_black.png"); + break; + } + } + + plusButton = new QPushButton(labelIconPlus, ""); plusButton->setMaximumSize(QSize(20,20)); plusButton->setObjectName("plusBttn"); - minusButton = new QPushButton(QIcon(":/pixmaps/minus.png"), ""); + minusButton = new QPushButton(labelIconMinus, ""); minusButton->setMaximumSize(QSize(20,20)); minusButton->setObjectName("minBttn"); diff --git a/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp b/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp index df94bf46c7..cc7a8f4c92 100644 --- a/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp +++ b/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp @@ -55,13 +55,27 @@ polygonRoiToolBox::polygonRoiToolBox(QWidget *parent ) : explanation->setStyleSheet("font: italic"); layout->addWidget(explanation ); + // Activation button activateTBButton = new QPushButton(tr("Activate Toolbox")); activateTBButton->setToolTip(tr("Activate closed polygon mode. You should only have one view.")); activateTBButton->setCheckable(true); activateTBButton->setObjectName("closedPolygonButton"); connect(activateTBButton,SIGNAL(toggled(bool)),this,SLOT(clickClosePolygon(bool))); connect(activateTBButton, &QAbstractButton::toggled, [=] (bool state) { explanation->setVisible(!state); }); + auto activateTBLayout = new QHBoxLayout(); + layout->addLayout(activateTBLayout); + activateTBLayout->addWidget(activateTBButton); + + // Add label management tool + QString identifier = speciality.toLower() + QString("LabelToolBox"); + pMedToolBox = medToolBoxFactory::instance()->createToolBox(identifier); + pMedToolBox->header()->hide(); + pMedToolBox->hide(); + pMedToolBox->setObjectName("labelTool"); + layout->addWidget(pMedToolBox); + connect(activateTBButton, SIGNAL(toggled(bool)), pMedToolBox, SLOT(setEnabled(bool)), Qt::UniqueConnection); + // Actions on contours interpolate = new QCheckBox(tr("Interpolate between contours")); interpolate->setToolTip("Interpolate between master ROIs"); interpolate->setObjectName("interpolateButton"); @@ -69,7 +83,7 @@ polygonRoiToolBox::polygonRoiToolBox(QWidget *parent ) : connect(interpolate,SIGNAL(clicked(bool)) ,this,SLOT(interpolateCurve(bool))); auto repulsorLayout = new QHBoxLayout(); - repulsorLabel = new QLabel("Correct contours"); + repulsorLabel = new QLabel("Correct contours:"); repulsorLayout->addWidget(repulsorLabel); repulsorTool = new QPushButton(tr("Repulsor")); @@ -79,23 +93,12 @@ polygonRoiToolBox::polygonRoiToolBox(QWidget *parent ) : connect(repulsorTool,SIGNAL(clicked(bool)),this,SLOT(activateRepulsor(bool))); repulsorLayout->addWidget(repulsorTool); - auto activateTBLayout = new QHBoxLayout(); - layout->addLayout(activateTBLayout ); - activateTBLayout->addWidget(activateTBButton); - - // Add Contour Management Toolbox - QString identifier = speciality.toLower() + QString("LabelToolBox"); - pMedToolBox = medToolBoxFactory::instance()->createToolBox(identifier); - pMedToolBox->header()->hide(); - pMedToolBox->hide(); - layout->addWidget(pMedToolBox); - connect(activateTBButton, SIGNAL(toggled(bool)), pMedToolBox, SLOT(setEnabled(bool)), Qt::UniqueConnection); - auto contoursActionLayout = new QVBoxLayout(); layout->addLayout(contoursActionLayout ); contoursActionLayout->addWidget(interpolate); contoursActionLayout->addLayout(repulsorLayout); + // Export widgets saveLabel = new QLabel("Save segmentations as:"); saveLabel->setObjectName("saveLabel"); auto saveButtonsLayout = new QHBoxLayout(); diff --git a/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp b/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp index e45a6e55d2..01756ac4a2 100644 --- a/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp +++ b/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp @@ -392,6 +392,9 @@ QMenu *baseViewEvent::changeLabelActions(polygonLabel* closestLabel) roiToAdd->pasteContour(nodes); setLabelActivationState(); deleteContour(closestLabel); + // Re-render the ROI + roiToAdd->Off(); + roiToAdd->On(); }); changeMenu->addAction(action); } diff --git a/src/plugins/process/itkDWIBrainMaskCalculatorProcess/CMakeLists.txt b/src/plugins/process/itkDWIBrainMaskCalculatorProcess/CMakeLists.txt index a72fae01da..0ae2ae70dd 100644 --- a/src/plugins/process/itkDWIBrainMaskCalculatorProcess/CMakeLists.txt +++ b/src/plugins/process/itkDWIBrainMaskCalculatorProcess/CMakeLists.txt @@ -19,8 +19,7 @@ set(TARGET_NAME itkDWIBrainMaskCalculatorProcessPlugin) ## Resolve dependencies ## ############################################################################# -find_package(TTK REQUIRED) -include(${TTK_USE_FILE}) +find_package(TTK REQUIRED COMPONENTS Registration ttkAlgorithms) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKImageStatistics ITKImageIntensity ITKSmoothing ITKThresholding ITKMathematicalMorphology ITKBinaryMathematicalMorphology ITKLabelVoting) include(${ITK_USE_FILE}) @@ -62,6 +61,9 @@ target_include_directories(${TARGET_NAME} target_link_libraries(${TARGET_NAME} ITKCommon ITKStatistics + ITKSmoothing + TTK::Registration + TTK::ttkAlgorithms Qt5::Core dtkCore dtkCoreSupport diff --git a/src/plugins/process/morphomath_operation/CMakeLists.txt b/src/plugins/process/morphomath_operation/CMakeLists.txt index 144ee92abd..1defd700fa 100644 --- a/src/plugins/process/morphomath_operation/CMakeLists.txt +++ b/src/plugins/process/morphomath_operation/CMakeLists.txt @@ -61,6 +61,7 @@ target_include_directories(${TARGET_NAME} target_link_libraries(${TARGET_NAME} ITKCommon + ITKMathematicalMorphology Qt5::Core dtkCore dtkLog diff --git a/src/plugins/process/single_filter/CMakeLists.txt b/src/plugins/process/single_filter/CMakeLists.txt index 051bb41707..9ef60d576f 100644 --- a/src/plugins/process/single_filter/CMakeLists.txt +++ b/src/plugins/process/single_filter/CMakeLists.txt @@ -61,6 +61,7 @@ target_include_directories(${TARGET_NAME} target_link_libraries(${TARGET_NAME} ITKCommon + ITKSmoothing Qt5::Core dtkCore dtkLog diff --git a/src/plugins/process/ttkTensorEstimationProcess/CMakeLists.txt b/src/plugins/process/ttkTensorEstimationProcess/CMakeLists.txt index abaaae627f..118f3386e9 100644 --- a/src/plugins/process/ttkTensorEstimationProcess/CMakeLists.txt +++ b/src/plugins/process/ttkTensorEstimationProcess/CMakeLists.txt @@ -7,8 +7,7 @@ set(TARGET_NAME ttkTensorEstimationProcessPlugin) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKFiniteDifference) include(${ITK_USE_FILE}) -find_package(TTK REQUIRED) -include(${TTK_USE_FILE}) +find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) ## ############################################################################# ## List Sources @@ -50,7 +49,8 @@ target_link_libraries(${TARGET_NAME} dtkCore dtkCoreSupport dtkLog - ITKTensor + TTK::ITKTensor + TTK::ttkAlgorithms medCoreLegacy medCore medWidgets diff --git a/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt b/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt index 9da93b1afd..35ace7785b 100644 --- a/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt +++ b/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt @@ -4,8 +4,7 @@ set(TARGET_NAME ttkTensorScalarMapsProcessPlugin) ## Resolve dependencies ## ############################################################################# -find_package(TTK REQUIRED) -include(${TTK_USE_FILE}) +find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) find_package(VTK REQUIRED COMPONENTS vtkRenderingCore) include(${VTK_USE_FILE}) @@ -53,7 +52,8 @@ target_link_libraries(${TARGET_NAME} dtkCore dtkCoreSupport dtkLog - ITKTensor + TTK::ITKTensor + TTK::ttkAlgorithms medCore medCoreLegacy medVtkInria diff --git a/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt b/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt index ee5f444e11..13314d64e2 100644 --- a/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt +++ b/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt @@ -32,8 +32,7 @@ include(${VTK_USE_FILE}) find_package(ITK REQUIRED ITKCommon ITKTransform ITKImageFunction) include(${ITK_USE_FILE}) -find_package(TTK REQUIRED) -include(${TTK_USE_FILE}) +find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) ## ############################################################################# ## List Sources ## ############################################################################# @@ -74,7 +73,8 @@ target_link_libraries(${TARGET_NAME} dtkCore dtkCoreSupport dtkLog - ITKTensor + TTK::ITKTensor + TTK::ttkAlgorithms ITKIOTransformBase medCore medCoreLegacy diff --git a/superbuild/projects_modules/ITK.cmake b/superbuild/projects_modules/ITK.cmake index dfacc24435..9cf28d26e0 100644 --- a/superbuild/projects_modules/ITK.cmake +++ b/superbuild/projects_modules/ITK.cmake @@ -40,7 +40,7 @@ if (NOT USE_SYSTEM_${ep}) set(git_url ${GITHUB_PREFIX}InsightSoftwareConsortium/ITK.git) -set(git_tag v5.0.0) +set(git_tag v5.2.1) ## ############################################################################# diff --git a/superbuild/projects_modules/LogDemons.cmake b/superbuild/projects_modules/LogDemons.cmake index 8670dfd4d2..e65ecc9301 100644 --- a/superbuild/projects_modules/LogDemons.cmake +++ b/superbuild/projects_modules/LogDemons.cmake @@ -39,8 +39,8 @@ if (NOT USE_SYSTEM_${ep}) ## Set up versioning control ## ############################################################################# - set(git_url ${GITHUB_PREFIX}Inria-Asclepios/LCC-LogDemons.git) - set(git_tag master) +set(git_url ${GITHUB_PREFIX}Inria-Asclepios/LCC-LogDemons.git) +set(git_tag ITK5.1.1) ## ############################################################################# ## Add specific cmake arguments for configuration step of the project diff --git a/superbuild/projects_modules/RPI.cmake b/superbuild/projects_modules/RPI.cmake index 2d95479073..25833c8221 100644 --- a/superbuild/projects_modules/RPI.cmake +++ b/superbuild/projects_modules/RPI.cmake @@ -40,8 +40,8 @@ if (NOT USE_SYSTEM_${ep}) ## Set up versioning control ## ############################################################################# -set(git_url ${GITHUB_PREFIX}Inria-Asclepios/RPI.git) -set(git_tag ITK5.0) +set(git_url ${GITHUB_PREFIX}medInria/RPI.git) +set(git_tag ITK5.1.1) ## ############################################################################# ## Add specific cmake arguments for configuration step of the project diff --git a/superbuild/projects_modules/TTK.cmake b/superbuild/projects_modules/TTK.cmake index f35768b003..9b46d4aaae 100644 --- a/superbuild/projects_modules/TTK.cmake +++ b/superbuild/projects_modules/TTK.cmake @@ -40,8 +40,8 @@ if (NOT USE_SYSTEM_${ep}) ## Set up versioning control ## ############################################################################# -set(git_url ${GITHUB_PREFIX}Inria-Asclepios/TTK-Public.git) -set(git_tag master) +set(git_url ${GITHUB_PREFIX}medInria/TTK.git) +set(git_tag ITK5.2.1) ## ############################################################################# ## Add specific cmake arguments for configuration step of the project diff --git a/superbuild/projects_modules/VTK.cmake b/superbuild/projects_modules/VTK.cmake index 26eda47885..72d34cd3cd 100644 --- a/superbuild/projects_modules/VTK.cmake +++ b/superbuild/projects_modules/VTK.cmake @@ -132,6 +132,8 @@ if(USE_Python) endif() list(APPEND cmake_args -DVTK_WRAP_PYTHON:BOOL=ON + -DModule_vtkPython:BOOL=ON + -DModule_vtkWrappingTools:BOOL=ON -DVTK_PYTHON_VERSION:STRING=${python_version} -DPYTHON_EXECUTABLE:PATH=${python_executable} -DPYTHON_INCLUDE_DIR:PATH=${python_include} From b7a9df11852bd43464391e23a7c3fd7d570aacfb Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Thu, 30 May 2024 15:04:22 +0200 Subject: [PATCH 02/20] [4.0.4] TTK dll copy error in Windows package (#854) * [4.0.3] branch for music plugins * [Windows] ttk dll copy error in package * [4.0.4] release notes and version number * [4.0.4] version number for master branch --- CMakeLists.txt | 2 +- RELEASE_NOTES.txt | 3 +++ packaging/apple/settings.json | 2 +- packaging/windows/WindowsPackaging.cmake | 4 +++- src/CMakeLists.txt | 2 +- superbuild/projects_modules/medInria.cmake | 5 ++++- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 651bf9d8b0..0c72dff1b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ endif() cmake_policy(SET CMP0074 NEW) if(NOT DEFINED ${MEDINRIA_SUPERBUILD_VERSION}) - set(MEDINRIA_SUPERBUILD_VERSION 4.0.3) + set(MEDINRIA_SUPERBUILD_VERSION 4.0.4) endif() SET(CMAKE_CXX_STANDARD 17) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 640e164b43..070481d38d 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,3 +1,6 @@ +MUSICardio 4.0.4: +- Fix some plugins wrongly loaded on Windows. + MUSICardio 4.0.3: - Switch to Ubuntu 22. - PolygonROI: update icons, fix a glitch when users change ROI label, hide label panel in pipelines. diff --git a/packaging/apple/settings.json b/packaging/apple/settings.json index 20460034eb..82bd6ffddf 100644 --- a/packaging/apple/settings.json +++ b/packaging/apple/settings.json @@ -7,7 +7,7 @@ "window": { "position": { "x": 100, "y": 100 }, "size": { "width": 640, "height": 300 } }, "contents": [ - { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.3/MUSICardio.app" }, + { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.4/MUSICardio.app" }, { "x": 480, "y": 165, "type": "link", "path": "/Applications" } ] } diff --git a/packaging/windows/WindowsPackaging.cmake b/packaging/windows/WindowsPackaging.cmake index fba1809b0a..9989550ca1 100644 --- a/packaging/windows/WindowsPackaging.cmake +++ b/packaging/windows/WindowsPackaging.cmake @@ -104,7 +104,7 @@ list(APPEND ${DCMTK_ROOT}/bin/Release ${VTK_ROOT}/bin/Release ${QtDCM_ROOT}/bin/Release - ${TTK_ROOT}/bin/Release + ${TTK_ROOT}/bin ${dtk_ROOT}/bin/Release ${RPI_ROOT}/bin/Release ${ZLIB_ROOT}/Release @@ -121,12 +121,14 @@ file(GLOB_RECURSE itk_files LIST_DIRECTORIES true \"${ITK_ROOT}/bin/*.dll\") file(GLOB_RECURSE vtk_files LIST_DIRECTORIES true \"${VTK_ROOT}/bin/*.dll\") file(GLOB_RECURSE dtk_files LIST_DIRECTORIES true \"${dtk_ROOT}/bin/*.dll\") file(GLOB_RECURSE dcm_files LIST_DIRECTORIES true \"${QtDCM_ROOT}/bin/*.dll\") +file(GLOB_RECURSE ttk_files LIST_DIRECTORIES true \"${TTK_DIR}/bin/*.dll\") file(GLOB_RECURSE qt5_files LIST_DIRECTORIES true \"${QT_BINARY_DIR}/*.dll\") file(GLOB_RECURSE zlib_files LIST_DIRECTORIES true \"${ZLIB_ROOT}/*.dll\") list(APPEND files \${itk_files}) list(APPEND files \${vtk_files}) list(APPEND files \${dtk_files}) list(APPEND files \${dcm_files}) +list(APPEND files \${ttk_files}) list(APPEND files \${qt5_files}) list(APPEND files \${zlib_files}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8f1a4d9f4f..aa0e14b99d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.19) if(NOT DEFINED ${medInria_VERSION}) - set(medInria_VERSION 4.0.3) + set(medInria_VERSION 4.0.4) endif() project(medInria VERSION ${medInria_VERSION}) diff --git a/superbuild/projects_modules/medInria.cmake b/superbuild/projects_modules/medInria.cmake index 00b49f51c7..9c2c1d64ad 100644 --- a/superbuild/projects_modules/medInria.cmake +++ b/superbuild/projects_modules/medInria.cmake @@ -141,8 +141,10 @@ ExternalProject_Add(${ep} ## ############################################################################# if (WIN32) + file(REAL_PATH ${TTK_DIR}/../../../ _TTK_DIR) file(TO_NATIVE_PATH ${ITK_ROOT} ITK_BIN_BASE) file(TO_NATIVE_PATH ${VTK_ROOT} VTK_BIN_BASE) + file(TO_NATIVE_PATH ${_TTK_DIR} TTK_BIN_BASE) file(TO_NATIVE_PATH ${dtk_ROOT} DTK_BIN_BASE) file(TO_NATIVE_PATH ${QtDCM_ROOT} DCM_BIN_BASE) file(TO_NATIVE_PATH ${_qt5Core_install_prefix} QT5_BIN_BASE) @@ -159,7 +161,8 @@ if (WIN32) COMMAND for %%I in ( ${VTK_BIN_BASE}\\bin\\${CONFIG_MODE}\\*.dll ) do (if EXIST ${MED_BIN_BASE}\\%%~nxI (del /S ${MED_BIN_BASE}\\%%~nxI & mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) else mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) COMMAND for %%I in ( ${DTK_BIN_BASE}\\bin\\${CONFIG_MODE}\\*.dll ) do (if EXIST ${MED_BIN_BASE}\\%%~nxI (del /S ${MED_BIN_BASE}\\%%~nxI & mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) else mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) COMMAND for %%I in ( ${DCM_BIN_BASE}\\bin\\${CONFIG_MODE}\\*.dll ) do (if EXIST ${MED_BIN_BASE}\\%%~nxI (del /S ${MED_BIN_BASE}\\%%~nxI & mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) else mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) - COMMAND for %%I in ( ${QT5_BIN_BASE}\\bin\\*.dll ) do (if EXIST ${MED_BIN_BASE}\\%%~nxI (del /S ${MED_BIN_BASE}\\%%~nxI & mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) else mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) + COMMAND for %%I in ( ${TTK_BIN_BASE}\\bin\\*.dll ) do (if EXIST ${MED_BIN_BASE}\\%%~nxI (del /S ${MED_BIN_BASE}\\%%~nxI & mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) else mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) + COMMAND for %%I in ( ${QT5_BIN_BASE}\\bin\\*.dll ) do (if EXIST ${MED_BIN_BASE}\\%%~nxI (del /S ${MED_BIN_BASE}\\%%~nxI & mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) else mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) COMMAND for %%I in ( ${PYNCPP_BIN_BASE}\\bin\\*.dll ) do (if EXIST ${MED_BIN_BASE}\\%%~nxI (del /S ${MED_BIN_BASE}\\%%~nxI & mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) else mklink /H ${MED_BIN_BASE}\\%%~nxI %%~fI) ) endif() From b58bf3f6dea5feecec2c3e747379e5b19b61cc81 Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Thu, 17 Oct 2024 13:13:05 +0200 Subject: [PATCH 03/20] [Registration] cast data in LCC and Diffeo, enhance txt in Manual (#861) * [Registration] cast data in LCC and Diffeo, enhance txt in Manual * [Registration] typo and static_cast --- CMakeLists.txt | 2 +- RELEASE_NOTES.txt | 5 ++ packaging/apple/settings.json | 2 +- src/CMakeLists.txt | 2 +- .../legacy/LCCLogDemons/LCCLogDemons.cpp | 60 +++++--------- .../legacy/LCCLogDemons/LCCLogDemons.h | 5 -- .../LCCLogDemons/LCCLogDemonsToolBox.cpp | 7 -- .../diffeomorphicDemons.cpp | 79 ++++++------------- .../diffeomorphicDemons/diffeomorphicDemons.h | 6 -- .../diffeomorphicDemonsToolBox.cpp | 7 -- .../manualRegistration/manualRegistration.cpp | 6 +- .../manualRegistrationToolBox.cpp | 9 ++- 12 files changed, 62 insertions(+), 128 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c72dff1b1..d23990d1d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ endif() cmake_policy(SET CMP0074 NEW) if(NOT DEFINED ${MEDINRIA_SUPERBUILD_VERSION}) - set(MEDINRIA_SUPERBUILD_VERSION 4.0.4) + set(MEDINRIA_SUPERBUILD_VERSION 4.0.5) endif() SET(CMAKE_CXX_STANDARD 17) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 070481d38d..1ed340aa08 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,3 +1,8 @@ +MUSICardio 4.0.5: +- Allow to use data with different size or spacing in LCCLogDemons and DiffeomorphicDemons. +- Manual Registration: enhance landmark numbers for better user understanding. +- Fix Histogram Analysis width problem displaying multi-results. + MUSICardio 4.0.4: - Fix some plugins wrongly loaded on Windows. diff --git a/packaging/apple/settings.json b/packaging/apple/settings.json index 82bd6ffddf..5053f4e752 100644 --- a/packaging/apple/settings.json +++ b/packaging/apple/settings.json @@ -7,7 +7,7 @@ "window": { "position": { "x": 100, "y": 100 }, "size": { "width": 640, "height": 300 } }, "contents": [ - { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.4/MUSICardio.app" }, + { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.5/MUSICardio.app" }, { "x": 480, "y": 165, "type": "link", "path": "/Applications" } ] } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aa0e14b99d..c35920091c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.19) if(NOT DEFINED ${medInria_VERSION}) - set(medInria_VERSION 4.0.4) + set(medInria_VERSION 4.0.5) endif() project(medInria VERSION ${medInria_VERSION}) diff --git a/src/plugins/legacy/LCCLogDemons/LCCLogDemons.cpp b/src/plugins/legacy/LCCLogDemons/LCCLogDemons.cpp index cf065add03..713e642cc9 100644 --- a/src/plugins/legacy/LCCLogDemons/LCCLogDemons.cpp +++ b/src/plugins/legacy/LCCLogDemons/LCCLogDemons.cpp @@ -19,7 +19,6 @@ // ///////////////////////////////////////////////////////////////// #include - #include #include #include @@ -167,17 +166,24 @@ QString LCCLogDemons::description() const template int LCCLogDemonsPrivate::update() { - int testResult = proc->testInputs(); - if (testResult != medAbstractProcessLegacy::SUCCESS) - { - return testResult; - } - + RegImageType *inputFixed = static_cast(proc->fixedImage().GetPointer()); + RegImageType *inputMoving = static_cast(proc->movingImages()[0].GetPointer()); + + // Cast spacing, origin, direction and size from the moving data to the fixed one + typedef itk::ResampleImageFilter ResampleFilterType; + typename ResampleFilterType::Pointer resampleFilter = ResampleFilterType::New(); + resampleFilter->SetOutputSpacing(inputFixed->GetSpacing()); + resampleFilter->SetOutputOrigin(inputFixed->GetOrigin()); + resampleFilter->SetOutputDirection(inputFixed->GetDirection()); + resampleFilter->SetSize(inputFixed->GetLargestPossibleRegion().GetSize()); + resampleFilter->SetInput(inputMoving); + resampleFilter->Update(); + inputMoving = resampleFilter->GetOutput(); + + // Register the fixed and moving data registrationMethod = new rpi::LCClogDemons (); - - registrationMethod->SetFixedImage((const RegImageType*) proc->fixedImage().GetPointer()); - registrationMethod->SetMovingImage((const RegImageType*) proc->movingImages()[0].GetPointer()); - + registrationMethod->SetFixedImage(inputFixed); + registrationMethod->SetMovingImage(inputMoving); registrationMethod->SetUpdateRule(updateRule); registrationMethod->SetVerbosity(verbose); @@ -219,12 +225,8 @@ int LCCLogDemonsPrivate::update() typedef itk::ResampleImageFilter< RegImageType,RegImageType, double> ResampleFilterType; typename ResampleFilterType::Pointer resampler = ResampleFilterType::New(); resampler->SetTransform(registrationMethod->GetDisplacementFieldTransformation()); - resampler->SetInput((const RegImageType*)proc->movingImages()[0].GetPointer()); - resampler->SetSize( proc->fixedImage()->GetLargestPossibleRegion().GetSize() ); - resampler->SetOutputOrigin( proc->fixedImage()->GetOrigin() ); - resampler->SetOutputSpacing( proc->fixedImage()->GetSpacing() ); - resampler->SetOutputDirection( proc->fixedImage()->GetDirection() ); - resampler->SetDefaultPixelValue( 0 ); + resampler->SetInput(inputMoving); + resampler->SetDefaultPixelValue(0); // Set the image interpolator switch(interpolatorType) @@ -266,31 +268,11 @@ int LCCLogDemonsPrivate::update() qDebug() << "ExceptionObject caught (resampler): " << err.GetDescription(); return medAbstractProcessLegacy::FAILURE; } - - itk::ImageBase<3>::Pointer result = resampler->GetOutput(); - result->DisconnectPipeline(); - - if (proc->output()) - { - proc->output()->setData (result); - } - return medAbstractProcessLegacy::SUCCESS; -} -medAbstractProcessLegacy::DataError LCCLogDemons::testInputs() -{ - if (d->proc->fixedImage()->GetLargestPossibleRegion().GetSize() - != d->proc->movingImages()[0]->GetLargestPossibleRegion().GetSize()) - { - return medAbstractProcessLegacy::MISMATCHED_DATA_SIZE; - } - - if (d->proc->fixedImage()->GetSpacing() - != d->proc->movingImages()[0]->GetSpacing()) + if (proc->output()) { - return medAbstractProcessLegacy::MISMATCHED_DATA_SPACING; + proc->output()->setData(resampler->GetOutput()); } - return medAbstractProcessLegacy::SUCCESS; } diff --git a/src/plugins/legacy/LCCLogDemons/LCCLogDemons.h b/src/plugins/legacy/LCCLogDemons/LCCLogDemons.h index 67314feae1..e608a34504 100644 --- a/src/plugins/legacy/LCCLogDemons/LCCLogDemons.h +++ b/src/plugins/legacy/LCCLogDemons/LCCLogDemons.h @@ -69,11 +69,6 @@ class LCCLogDemonsPLUGIN_EXPORT LCCLogDemons : public itkProcessRegistration */ virtual QString getTitleAndParameters(); - /** - * @brief testInputs() tests origin, dimension and spacing of the input - * @return medAbstractProcess::DataError according to the test result - */ - medAbstractProcessLegacy::DataError testInputs(); protected : /** * @brief diff --git a/src/plugins/legacy/LCCLogDemons/LCCLogDemonsToolBox.cpp b/src/plugins/legacy/LCCLogDemons/LCCLogDemonsToolBox.cpp index d0494cbff1..882178bc04 100644 --- a/src/plugins/legacy/LCCLogDemons/LCCLogDemonsToolBox.cpp +++ b/src/plugins/legacy/LCCLogDemons/LCCLogDemonsToolBox.cpp @@ -53,15 +53,8 @@ class LCCLogDemonsToolBoxPrivate LCCLogDemonsToolBox::LCCLogDemonsToolBox(QWidget *parent) : medAbstractSelectableToolBox(parent), d(new LCCLogDemonsToolBoxPrivate) { QWidget *widget = new QWidget(this); - QVBoxLayout * layout = new QVBoxLayout(); - QLabel *explanation = new QLabel("Drop 2 datasets with same size and spacing.\n"); - explanation->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); - explanation->setWordWrap(true); - explanation->setStyleSheet("font: italic"); - layout->addWidget(explanation); - // Standard parameters d->iterationsLine = new QLineEdit(); d->iterationsLine->setText("15x10x5"); diff --git a/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemons.cpp b/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemons.cpp index 953315b849..756df42df1 100644 --- a/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemons.cpp +++ b/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemons.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include // ///////////////////////////////////////////////////////////////// @@ -93,33 +93,29 @@ int diffeomorphicDemonsPrivate::update() { typedef itk::Image< PixelType, 3 > FixedImageType; typedef itk::Image< PixelType, 3 > MovingImageType; - typedef itk::Image< float, 3 > RegImageType; typedef double TransformScalarType; - int testResult = proc->testInputs(); - if (testResult != medAbstractProcessLegacy::SUCCESS) - { - return testResult; - } - - FixedImageType *inputFixed = (FixedImageType*) proc->fixedImage().GetPointer(); - MovingImageType *inputMoving = (MovingImageType*) proc->movingImages()[0].GetPointer(); - - // The output volume is going to located at the origin/direction of the fixed input. Needed for rpi::DiffeomorphicDemons - typedef itk::ChangeInformationImageFilter< FixedImageType > FilterType; - typename FilterType::Pointer filter = FilterType::New(); - filter->SetOutputOrigin(inputFixed->GetOrigin()); - filter->ChangeOriginOn(); - filter->SetOutputDirection(inputFixed->GetDirection()); - filter->ChangeDirectionOn(); - filter->SetInput(inputMoving); - + FixedImageType *inputFixed = static_cast(proc->fixedImage().GetPointer()); + MovingImageType *inputMoving = static_cast(proc->movingImages()[0].GetPointer()); + + // Cast spacing, origin, direction and size from the moving data to the fixed one + typedef itk::ResampleImageFilter ResampleFilterType; + typename ResampleFilterType::Pointer resampleFilter = ResampleFilterType::New(); + resampleFilter->SetOutputSpacing(inputFixed->GetSpacing()); + resampleFilter->SetOutputOrigin(inputFixed->GetOrigin()); + resampleFilter->SetOutputDirection(inputFixed->GetDirection()); + resampleFilter->SetSize(inputFixed->GetLargestPossibleRegion().GetSize()); + resampleFilter->SetInput(inputMoving); + resampleFilter->Update(); + inputMoving = resampleFilter->GetOutput(); + + // Register the fixed and moving data typedef rpi::DiffeomorphicDemons< RegImageType, RegImageType, TransformScalarType > RegistrationType; RegistrationType *registration = new RegistrationType; registrationMethod = registration; registration->SetFixedImage(inputFixed); - registration->SetMovingImage(filter->GetOutput()); + registration->SetMovingImage(inputMoving); registration->SetNumberOfIterations(iterations); registration->SetMaximumUpdateStepLength(maximumUpdateStepLength); registration->SetUpdateFieldStandardDeviation(updateFieldStandardDeviation); @@ -160,7 +156,6 @@ int diffeomorphicDemonsPrivate::update() // Print method parameters QString methodParameters = proc->getTitleAndParameters(); - qDebug() << "METHOD PARAMETERS"; qDebug() << methodParameters; @@ -181,19 +176,15 @@ int diffeomorphicDemonsPrivate::update() emit proc->progressed(80); - typedef itk::ResampleImageFilter< MovingImageType,MovingImageType,TransformScalarType > ResampleFilterType; - typename ResampleFilterType::Pointer resampler = ResampleFilterType::New(); - resampler->SetTransform(registration->GetTransformation()); - resampler->SetInput((const MovingImageType*) inputMoving); - resampler->SetSize( proc->fixedImage()->GetLargestPossibleRegion().GetSize() ); - resampler->SetOutputOrigin( proc->fixedImage()->GetOrigin() ); - resampler->SetOutputSpacing( proc->fixedImage()->GetSpacing() ); - resampler->SetOutputDirection( proc->fixedImage()->GetDirection() ); - resampler->SetDefaultPixelValue( 0 ); - + // Cast new transformation + typedef itk::ResampleImageFilter< MovingImageType,MovingImageType,TransformScalarType > ResampleTransformation; + typename ResampleTransformation::Pointer resampleTransformation = ResampleTransformation::New(); + resampleTransformation->SetTransform(registration->GetTransformation()); + resampleTransformation->SetInput(inputMoving); + resampleTransformation->SetDefaultPixelValue(0); try { - resampler->Update(); + resampleTransformation->Update(); } catch (itk::ExceptionObject & err) { @@ -201,33 +192,13 @@ int diffeomorphicDemonsPrivate::update() return medAbstractProcessLegacy::FAILURE; } - itk::ImageBase<3>::Pointer result = resampler->GetOutput(); - result->DisconnectPipeline(); - if (proc->output()) { - proc->output()->setData (result); + proc->output()->setData(resampleTransformation->GetOutput()); } return medAbstractProcessLegacy::SUCCESS; } -medAbstractProcessLegacy::DataError diffeomorphicDemons::testInputs() -{ - if (d->proc->fixedImage()->GetLargestPossibleRegion().GetSize() - != d->proc->movingImages()[0]->GetLargestPossibleRegion().GetSize()) - { - return medAbstractProcessLegacy::MISMATCHED_DATA_SIZE; - } - - if (d->proc->fixedImage()->GetSpacing() - != d->proc->movingImages()[0]->GetSpacing()) - { - return medAbstractProcessLegacy::MISMATCHED_DATA_SPACING; - } - - return medAbstractProcessLegacy::SUCCESS; -} - int diffeomorphicDemons::update(itkProcessRegistration::ImageType imgType) { // Cast has been done in itkProcessRegistration diff --git a/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemons.h b/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemons.h index 14da0f132f..79f44ae1f6 100644 --- a/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemons.h +++ b/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemons.h @@ -138,12 +138,6 @@ class DIFFEOMORPHICDEMONSPLUGIN_EXPORT diffeomorphicDemons : public itkProcessRe */ virtual QString getTitleAndParameters(); - /** - * @brief testInputs() tests origin, dimension and spacing of the input - * @return medAbstractProcess::DataError according to the test result - */ - medAbstractProcessLegacy::DataError testInputs(); - protected : /** * @brief Writes the transformation, in this case the displacement field, diff --git a/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemonsToolBox.cpp b/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemonsToolBox.cpp index 041bfeaa41..4739021f18 100644 --- a/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemonsToolBox.cpp +++ b/src/plugins/legacy/diffeomorphicDemons/diffeomorphicDemonsToolBox.cpp @@ -42,15 +42,8 @@ diffeomorphicDemonsToolBox::diffeomorphicDemonsToolBox(QWidget *parent) : medAbstractSelectableToolBox(parent), d(new diffeomorphicDemonsToolBoxPrivate) { QWidget *widget = new QWidget(this); - QVBoxLayout *layout = new QVBoxLayout(); - QLabel *explanation = new QLabel("Drop 2 datasets with same size and spacing.\n"); - explanation->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); - explanation->setWordWrap(true); - explanation->setStyleSheet("font: italic"); - layout->addWidget(explanation); - d->iterationsBox = new QLineEdit(); d->iterationsBox->setText("15x10x5"); d->iterationsBox->setToolTip(tr("Each number of iteration per level must be separated by \"x\". From coarser to finest levels")); diff --git a/src/plugins/legacy/manualRegistration/manualRegistration.cpp b/src/plugins/legacy/manualRegistration/manualRegistration.cpp index 04ba54193e..01fd43c7ad 100644 --- a/src/plugins/legacy/manualRegistration/manualRegistration.cpp +++ b/src/plugins/legacy/manualRegistration/manualRegistration.cpp @@ -160,12 +160,12 @@ template int manualRegistrationPriv typedef itk::ResampleImageFilter< MovingImageType,MovingImageType,TransformScalarType > ResampleFilterType; typename ResampleFilterType::Pointer resampler = ResampleFilterType::New(); resampler->SetTransform(transform); - resampler->SetInput((const MovingImageType*)proc->movingImages()[0].GetPointer()); - resampler->SetSize( proc->fixedImage()->GetLargestPossibleRegion().GetSize() ); + resampler->SetInput(static_cast(proc->movingImages()[0].GetPointer())); + resampler->SetSize(proc->fixedImage()->GetLargestPossibleRegion().GetSize()); resampler->SetOutputOrigin( proc->fixedImage()->GetOrigin() ); resampler->SetOutputSpacing( proc->fixedImage()->GetSpacing() ); resampler->SetOutputDirection( proc->fixedImage()->GetDirection() ); - resampler->SetDefaultPixelValue( 0 ); + resampler->SetDefaultPixelValue(0); try { diff --git a/src/plugins/legacy/manualRegistration/manualRegistrationToolBox.cpp b/src/plugins/legacy/manualRegistration/manualRegistrationToolBox.cpp index db9a4614b5..b5b1013f74 100644 --- a/src/plugins/legacy/manualRegistration/manualRegistrationToolBox.cpp +++ b/src/plugins/legacy/manualRegistration/manualRegistrationToolBox.cpp @@ -70,9 +70,10 @@ manualRegistrationToolBox::manualRegistrationToolBox(QWidget *parent) d->b_startManualRegistration->setObjectName("startManualRegistrationButton"); d->explanation = new QLabel("To add a landmark: \n\tShift + left mouse button\nTo remove a pair of landmarks: \n\tBackspace + left mouse button", widget); + d->explanation->setStyleSheet("font: italic"); - d->numberOfLdInLeftContainer = new QLabel("Number of landmarks in left container: 0", widget); - d->numberOfLdInRightContainer = new QLabel("Number of landmarks in right container: 0", widget); + d->numberOfLdInLeftContainer = new QLabel("Number of landmarks in left container: 0", widget); + d->numberOfLdInRightContainer = new QLabel("Number of landmarks in right container: 0", widget); // Choice between transformations QHBoxLayout* transformationLayout = new QHBoxLayout; @@ -564,8 +565,8 @@ void manualRegistrationToolBox::displayButtons(bool show) void manualRegistrationToolBox::updateGUI(int left, int right) { - d->numberOfLdInLeftContainer->setText( "Number of landmarks in left container: " + QString::number(left)); - d->numberOfLdInRightContainer->setText("Number of landmarks in right container: " + QString::number(right)); + d->numberOfLdInLeftContainer->setText(QString("Number of landmarks in left container: %1").arg(left)); + d->numberOfLdInRightContainer->setText(QString("Number of landmarks in right container: %1").arg(right)); if (left == right) { From 62e5c24fc47279da3141a998c5d8ca982880ed72 Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Tue, 19 Nov 2024 16:35:36 +0100 Subject: [PATCH 04/20] [PolygonROI] rm shift-click, solve interactor style after repulsor, hid widgets (#862) * [PolygonROI] rm shift-click, solve interactor style after repulsor, hide widgets * [Release] 4.0.6 polygon roi fixes --- CMakeLists.txt | 2 +- RELEASE_NOTES.txt | 3 ++ packaging/apple/settings.json | 2 +- src/CMakeLists.txt | 2 +- .../medImageIO/itkDataImageReaderBase.cpp | 8 ---- .../toolboxes/defaultLabelToolBox.cpp | 1 + .../toolboxes/polygonRoiToolBox.cpp | 43 ++++++++++++------- .../polygonRoi/toolboxes/polygonRoiToolBox.h | 1 + .../polygonRoi/viewevent/baseViewEvent.cpp | 18 +------- .../polygonRoi/viewevent/baseViewEvent.h | 3 +- 10 files changed, 38 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d23990d1d3..db2ccb3cce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ endif() cmake_policy(SET CMP0074 NEW) if(NOT DEFINED ${MEDINRIA_SUPERBUILD_VERSION}) - set(MEDINRIA_SUPERBUILD_VERSION 4.0.5) + set(MEDINRIA_SUPERBUILD_VERSION 4.0.6) endif() SET(CMAKE_CXX_STANDARD 17) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 1ed340aa08..6285b2aebb 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,3 +1,6 @@ +MUSICardio 4.0.6: +- PolygonROI: remove shift-click to draw, fix contrast after deactivation of repulsor and hide deactivated widgets. + MUSICardio 4.0.5: - Allow to use data with different size or spacing in LCCLogDemons and DiffeomorphicDemons. - Manual Registration: enhance landmark numbers for better user understanding. diff --git a/packaging/apple/settings.json b/packaging/apple/settings.json index 5053f4e752..9f5bea1fcd 100644 --- a/packaging/apple/settings.json +++ b/packaging/apple/settings.json @@ -7,7 +7,7 @@ "window": { "position": { "x": 100, "y": 100 }, "size": { "width": 640, "height": 300 } }, "contents": [ - { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.5/MUSICardio.app" }, + { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.6/MUSICardio.app" }, { "x": 480, "y": 165, "type": "link", "path": "/Applications" } ] } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c35920091c..4d19e8c2c1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.19) if(NOT DEFINED ${medInria_VERSION}) - set(medInria_VERSION 4.0.5) + set(medInria_VERSION 4.0.6) endif() project(medInria VERSION ${medInria_VERSION}) diff --git a/src/layers/legacy/medImageIO/itkDataImageReaderBase.cpp b/src/layers/legacy/medImageIO/itkDataImageReaderBase.cpp index eeefdf807c..cc977605a0 100644 --- a/src/layers/legacy/medImageIO/itkDataImageReaderBase.cpp +++ b/src/layers/legacy/medImageIO/itkDataImageReaderBase.cpp @@ -240,10 +240,6 @@ bool itkDataImageReaderBase::readInformation (const QString& path) { medData->setMetaData(metaDataKey, QString(value.c_str())); } - else - { - qDebug() << metaObject()->className() << ":: found unknown key:" << QString::fromStdString(key); - } } // [END OF HACK] @@ -326,10 +322,6 @@ void itkDataImageReaderBase::extractMetaData() { data()->setMetaData(metaDataKey, QString(value.c_str())); } - else - { - qDebug() << metaObject()->className() << ":: found unknown key:" << QString::fromStdString(key); - } } } diff --git a/src/plugins/legacy/polygonRoi/toolboxes/defaultLabelToolBox.cpp b/src/plugins/legacy/polygonRoi/toolboxes/defaultLabelToolBox.cpp index b16718bfd2..20f98cbc69 100644 --- a/src/plugins/legacy/polygonRoi/toolboxes/defaultLabelToolBox.cpp +++ b/src/plugins/legacy/polygonRoi/toolboxes/defaultLabelToolBox.cpp @@ -24,6 +24,7 @@ defaultLabelToolBox::defaultLabelToolBox(QWidget *parent): auto widget = new QWidget(); auto layout = new QVBoxLayout; + layout->setContentsMargins(0, 0, 0, 0); widget->setLayout(layout); dataName = new QLabel("No Data"); diff --git a/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp b/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp index cc7a8f4c92..3ee5b22713 100644 --- a/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp +++ b/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp @@ -74,6 +74,7 @@ polygonRoiToolBox::polygonRoiToolBox(QWidget *parent ) : pMedToolBox->setObjectName("labelTool"); layout->addWidget(pMedToolBox); connect(activateTBButton, SIGNAL(toggled(bool)), pMedToolBox, SLOT(setEnabled(bool)), Qt::UniqueConnection); + connect(activateTBButton, SIGNAL(toggled(bool)), pMedToolBox, SLOT(setVisible(bool)), Qt::UniqueConnection); // Actions on contours interpolate = new QCheckBox(tr("Interpolate between contours")); @@ -396,6 +397,7 @@ void polygonRoiToolBox::clickClosePolygon(bool state) } else { + activateTBButton->setText("Deactivate Toolbox"); pMedToolBox->show(); for (baseViewEvent *event : viewEventHash.values()) { @@ -413,12 +415,8 @@ void polygonRoiToolBox::clickClosePolygon(bool state) { viewEventHash.values().first()->getCurrentView()->selectedRequest(true); } - saveBinaryMaskButton->setEnabled(state); - saveContourButton->setEnabled(state); - saveLabel->setEnabled(state); - interpolate->setEnabled(state); - repulsorTool->setEnabled(state); - repulsorLabel->setEnabled(state); + + enableInnerWidgets(state); } } @@ -451,14 +449,27 @@ void polygonRoiToolBox::disableButtons() { activateTBButton->setEnabled(false); activateTBButton->setChecked(false); - repulsorTool->setEnabled(false); - repulsorTool->setChecked(false); - repulsorLabel->setEnabled(false); - saveBinaryMaskButton->setEnabled(false); - saveContourButton->setEnabled(false); - saveLabel->setEnabled(false); - interpolate->setEnabled(false); + + enableInnerWidgets(false); interpolate->setChecked(true); + repulsorTool->setChecked(false); +} + +void polygonRoiToolBox::enableInnerWidgets(bool state) +{ + repulsorTool->setEnabled(state); + repulsorTool->setVisible(state); + repulsorLabel->setEnabled(state); + repulsorLabel->setVisible(state); + saveBinaryMaskButton->setEnabled(state); + saveBinaryMaskButton->setVisible(state); + saveContourButton->setEnabled(state); + saveContourButton->setVisible(state); + saveLabel->setEnabled(state); + saveLabel->setVisible(state); + interpolate->setEnabled(state); + interpolate->setVisible(state); + helpButton->setVisible(state); } void polygonRoiToolBox::saveContours() @@ -597,11 +608,11 @@ void polygonRoiToolBox::showHelp() const QString main = QString("

Main features

") + QString("
    ") - + QString("
  • Draw a contour: shift+click on the data to create a contour
  • ") + + QString("
  • Draw a contour: click on the data to create a contour
  • ") + QString("
  • Add a new label: click on '+' button in the label list
  • ") + QString("
  • Remove a label: click on '-' button in the label list
  • ") - + QString("
  • Use a new label: select a label in the list, then shift+click on the data
  • ") - + QString("
  • Alt+click: draw a landmark at that position in all views
  • ") + + QString("
  • Use a new label: select a label in the list, then click on the data
  • ") + + QString("
  • Alt+click: draw a landmark at that position in all slices
  • ") + QString("
"); QString shortcut = QString("

Shortcuts

") diff --git a/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.h b/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.h index 3e6caebb08..e79f547157 100644 --- a/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.h +++ b/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.h @@ -71,6 +71,7 @@ public slots: private slots: void disableButtons(); + void enableInnerWidgets(bool state); void saveContours(); void saveBinaryImage(); diff --git a/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp b/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp index 01756ac4a2..aa2726b613 100644 --- a/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp +++ b/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp @@ -224,7 +224,7 @@ bool baseViewEvent::mousePressEvent(medAbstractView * view, QMouseEvent *mouseEv globalVtkLeftButtonBehaviour = view2d->GetLeftButtonInteractionStyle(); view2d->SetLeftButtonInteractionStyle(vtkInteractorStyleImageView2D::InteractionTypeNull); } - else if (mouseEvent->modifiers() == Qt::ShiftModifier) + else if (mouseEvent->modifiers() == Qt::NoModifier) { for (polygonLabel *label : labelList) { @@ -237,20 +237,6 @@ bool baseViewEvent::mousePressEvent(medAbstractView * view, QMouseEvent *mouseEv } leftButtonBehaviour(view); } - else if (mouseEvent->modifiers()==Qt::NoModifier) - { - if (!isRepulsorActivated ) - { - vtkImageView2D *view2d = static_cast(currentView->backend())->view2D; - int currentLeftButtonBehaviour = view2d->GetLeftButtonInteractionStyle(); - if (currentLeftButtonBehaviour != globalVtkLeftButtonBehaviour && - currentLeftButtonBehaviour != vtkInteractorStyleImageView2D::InteractionTypeNull) - { - globalVtkLeftButtonBehaviour = currentLeftButtonBehaviour; - } - view2d->SetLeftButtonInteractionStyle(globalVtkLeftButtonBehaviour); - } - } } else if (mouseEvent->button()==Qt::RightButton) { @@ -410,7 +396,6 @@ void baseViewEvent::setLabelActivationState() } } - bool baseViewEvent::rightButtonBehaviour(medAbstractView *view, QMouseEvent *mouseEvent) { if (!view) @@ -706,7 +691,6 @@ void baseViewEvent::activateRepulsor(bool state) cursorState = CURSORSTATE::CS_DEFAULT; vtkInteractorStyleImageView2D *interactorStyle2D = vtkInteractorStyleImageView2D::New(); globalVtkLeftButtonBehaviour = view2d->GetLeftButtonInteractionStyle(); - interactorStyle2D->SetLeftButtonInteraction(vtkInteractorStyleImageView2D::InteractionTypeNull); view2d->SetInteractorStyle(interactorStyle2D); view2d->SetupInteractor(originalInteractor); interactorStyle2D->Delete(); diff --git a/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.h b/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.h index df75fff95b..f35a9ed0bb 100644 --- a/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.h +++ b/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.h @@ -19,6 +19,7 @@ #include #include #include + #include #include #include @@ -120,7 +121,7 @@ private slots: QList copyNodesList; double savedMousePosition[2]; dtkSmartPointer contourOutput; - vtkRenderWindowInteractor* originalInteractor; + vtkRenderWindowInteractor *originalInteractor; void leftButtonBehaviour(medAbstractView *view); bool rightButtonBehaviour(medAbstractView *view, QMouseEvent *mouseEvent); From 63fdbf366e87c1760145de6f76747d97452ff79a Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Tue, 19 Nov 2024 17:06:32 +0100 Subject: [PATCH 05/20] [VTK9.2.6] switch to more recent VTK and ITK5.4rc04 (#859) * [Fedora40] update ext libs to ITK5.4rc04 * [ITK] path to itk5.4rc04 branches in extlibs * [VTK9.0.1] base to switch medInria on it * [VTK9] compilation debug * [VTK9] first step reslice * [VTK9] switch to 9.2.6 and debug vtk bug in Reslice tlbx * [reslice] put back old copyright * [VTK] rebase code on master and adapt to v9.2.6 * [VTK9.2.6] error with vtkProbeFilter on vtk8 or vtk9 data, switch to manual interpolation * [Startup] remove unnecessay methods/var * [VTK9] python version and vtk modules * [VTK9] vtk modules in medVtkInria * [VTK9] vtk ptr cleaning * [VTK9] module for windows and nodiscard method * [Unix] remove vtk qt parameters * [VTK9] module enable GUISupportQt * [VTK9] module enable renderingQt * [VisualStudio] avoid ambiguous call to overloaded isnan method * [VTK9] Qt 5 * [ROOT] last package_DIR to package_ROOT * [TTK] remove real_path to TTK * [VTK9] remove include_directories() * [VTK9] fix problem with non allocated var * [TTK] change path to new branch --- packaging/windows/WindowsPackaging.cmake | 2 +- packaging/windows/medInria-dev.bat.in | 8 +- packaging/windows/medInria.bat.in | 8 +- .../medPluginGenerator/tests/CMakeLists.txt | 6 +- .../tests/medPluginGeneratorTest.cpp | 6 +- src/cmake/module/set_exe_install_rules.cmake | 2 +- .../medStartupSettingsWidget.cpp | 12 -- src/layers/legacy/medImageIO/CMakeLists.txt | 2 +- src/layers/legacy/medLog/CMakeLists.txt | 6 +- src/layers/legacy/medUtilities/CMakeLists.txt | 4 +- .../legacy/medVtkDataMeshBase/CMakeLists.txt | 8 +- .../medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx | 18 +- .../medVtkDataMeshBase/vtkMetaVolumeMesh.cxx | 22 +- src/layers/legacy/medVtkInria/CMakeLists.txt | 29 +-- .../vtkImageView/vtkAxes2DWidget.cxx | 2 +- .../vtkImageView/vtkImageView3D.cxx | 3 +- .../vtkTessellatedSphereSource.cxx | 17 +- .../toolboxes/medDiffusionSelectorToolBox.cpp | 2 +- .../iterativeClosestPoint/CMakeLists.txt | 7 +- .../limit/vtkLimitVectorsToVOI.cxx | 8 + .../legacy/itkDataImage/tests/CMakeLists.txt | 4 +- .../legacy/itkDataSHImage/CMakeLists.txt | 4 +- .../management/vtkSphericalHarmonicSource.h | 2 +- .../legacy/itkDataTensorImage/CMakeLists.txt | 7 +- .../legacy/manualRegistration/CMakeLists.txt | 4 +- .../medCreateMeshFromMask/CMakeLists.txt | 4 +- .../legacy/medExportVideo/CMakeLists.txt | 15 +- .../legacy/medRemeshing/CMakeLists.txt | 8 +- .../legacy/medVtkFibersData/CMakeLists.txt | 6 +- .../medVtkFibersDataInteractor.cpp | 4 +- .../limit/vtkLimitFibersToROI.cxx | 2 +- .../limit/vtkLimitFibersToVOI.cxx | 2 +- .../manager/vtkFiberPickerCallback.cpp | 12 +- .../readers/vtkXMLFiberDataSetReader.cxx | 1 + src/plugins/legacy/medVtkView/CMakeLists.txt | 7 +- src/plugins/legacy/medVtkView/medVtkView.cpp | 8 +- .../legacy/meshManipulation/CMakeLists.txt | 5 +- src/plugins/legacy/meshMapping/CMakeLists.txt | 4 +- .../legacy/meshMapping/meshMapping.cpp | 104 +++------- src/plugins/legacy/meshMapping/meshMapping.h | 4 - src/plugins/legacy/polygonRoi/CMakeLists.txt | 7 +- src/plugins/legacy/reformat/CMakeLists.txt | 9 +- .../legacy/reformat/medResliceViewer.cpp | 143 ++++++------- .../legacy/reformat/medResliceViewer.h | 10 +- .../variationalSegmentation/CMakeLists.txt | 4 +- src/plugins/legacy/voiCutter/CMakeLists.txt | 6 +- src/plugins/legacy/vtkDataMesh/CMakeLists.txt | 9 +- .../ttkTensorScalarMapsProcess/CMakeLists.txt | 7 +- .../CMakeLists.txt | 8 +- superbuild/patches/VTK.patch | 193 ------------------ superbuild/projects_modules/ITK.cmake | 2 +- superbuild/projects_modules/LogDemons.cmake | 2 +- superbuild/projects_modules/RPI.cmake | 4 +- superbuild/projects_modules/TTK.cmake | 2 +- superbuild/projects_modules/VTK.cmake | 27 +-- superbuild/projects_modules/medInria.cmake | 3 +- .../projects_modules/music-plugins.cmake | 4 +- 57 files changed, 269 insertions(+), 550 deletions(-) delete mode 100644 superbuild/patches/VTK.patch diff --git a/packaging/windows/WindowsPackaging.cmake b/packaging/windows/WindowsPackaging.cmake index 9989550ca1..4548e07d63 100644 --- a/packaging/windows/WindowsPackaging.cmake +++ b/packaging/windows/WindowsPackaging.cmake @@ -121,7 +121,7 @@ file(GLOB_RECURSE itk_files LIST_DIRECTORIES true \"${ITK_ROOT}/bin/*.dll\") file(GLOB_RECURSE vtk_files LIST_DIRECTORIES true \"${VTK_ROOT}/bin/*.dll\") file(GLOB_RECURSE dtk_files LIST_DIRECTORIES true \"${dtk_ROOT}/bin/*.dll\") file(GLOB_RECURSE dcm_files LIST_DIRECTORIES true \"${QtDCM_ROOT}/bin/*.dll\") -file(GLOB_RECURSE ttk_files LIST_DIRECTORIES true \"${TTK_DIR}/bin/*.dll\") +file(GLOB_RECURSE ttk_files LIST_DIRECTORIES true \"${TTK_ROOT}/bin/*.dll\") file(GLOB_RECURSE qt5_files LIST_DIRECTORIES true \"${QT_BINARY_DIR}/*.dll\") file(GLOB_RECURSE zlib_files LIST_DIRECTORIES true \"${ZLIB_ROOT}/*.dll\") list(APPEND files \${itk_files}) diff --git a/packaging/windows/medInria-dev.bat.in b/packaging/windows/medInria-dev.bat.in index 27c027980f..969a1f06ce 100644 --- a/packaging/windows/medInria-dev.bat.in +++ b/packaging/windows/medInria-dev.bat.in @@ -3,9 +3,9 @@ call "%@VS_TYPE@%\..\..\VC\vcvarsall.bat" @WIN_TYPE@ REM This .bat sets the environment variables medInria_PLUGINS_DIR and PATH and launches Visual Studio REM Usage : medInria-dev.bat @echo off -set PATH=%PATH%;@dtk_DIR@/bin/%1;@ITK_DIR@/bin/%1;@TTK_DIR@/bin/%1;@VTK_DIR@/bin/%1;@QtDCM_DIR@/bin/%1;@medInria_DIR@/bin/%1;@QT_BINARY_DIR@ -set MEDINRIA_PLUGINS_DIR=@medInria_DIR@/bin/plugins/%1;@DEV_PLUGINS_DIRS@ -set MEDINRIA_PLUGINS_DIR_LEGACY=@medInria_DIR@/bin/plugins_legacy/%1:@DEV_PLUGINS_LEGACY_DIRS@ +set PATH=%PATH%;@dtk_ROOT@/bin/%1;@ITK_ROOT@/bin/%1;@TTK_ROOT@/bin/%1;@VTK_ROOT@/bin/%1;@QtDCM_ROOT@/bin/%1;@medInria_BINARY_DIR@/bin/%1;@QT_BINARY_DIR@ +set MEDINRIA_PLUGINS_DIR=@medInria_BINARY_DIR@/bin/plugins/%1;@DEV_PLUGINS_DIRS@ +set MEDINRIA_PLUGINS_DIR_LEGACY=@medInria_BINARY_DIR@/bin/plugins_legacy/%1:@DEV_PLUGINS_LEGACY_DIRS@ -start devenv.exe @medInria_DIR@/ALL_BUILD.vcxproj +start devenv.exe @medInria_BINARY_DIR@/ALL_BUILD.vcxproj exit diff --git a/packaging/windows/medInria.bat.in b/packaging/windows/medInria.bat.in index c1b5cce94a..d3c41313dd 100755 --- a/packaging/windows/medInria.bat.in +++ b/packaging/windows/medInria.bat.in @@ -1,11 +1,11 @@ REM This .bat sets the environment variables medInria_PLUGINS_DIR and PATH and launches medInria REM Usage : medInria.bat @echo off -set PATH=%PATH%;@dtk_DIR@/bin/%1;@ITK_DIR@/bin/%1;@TTK_DIR@/bin/%1;@VTK_DIR@/bin/%1;@QtDCM_DIR@/bin/%1;@medInria_DIR@/bin/%1;@QT_BINARY_DIR@ -set MEDINRIA_PLUGINS_DIR=@medInria_DIR@/plugins/%1:@DEV_PLUGINS_DIRS@ -set MEDINRIA_PLUGINS_DIR_LEGACY=@medInria_DIR@/plugins_legacy/%1:@DEV_PLUGINS_LEGACY_DIRS@ +set PATH=%PATH%;@dtk_ROOT@/bin/%1;@ITK_ROOT@/bin/%1;@TTK_ROOT@/bin/%1;@VTK_ROOT@/bin/%1;@QtDCM_ROOT@/bin/%1;@medInria_BINARY_DIR@/bin/%1;@QT_BINARY_DIR@ +set MEDINRIA_PLUGINS_DIR=@medInria_BINARY_DIR@/plugins/%1:@DEV_PLUGINS_DIRS@ +set MEDINRIA_PLUGINS_DIR_LEGACY=@medInria_BINARY_DIR@/plugins_legacy/%1:@DEV_PLUGINS_LEGACY_DIRS@ -set BIN_PATH=@medInria_DIR@/bin/%1 +set BIN_PATH=@medInria_BINARY_DIR@/bin/%1 shift set args=%1 diff --git a/src/app/medPluginGenerator/tests/CMakeLists.txt b/src/app/medPluginGenerator/tests/CMakeLists.txt index f5e401ac3f..def2f76786 100644 --- a/src/app/medPluginGenerator/tests/CMakeLists.txt +++ b/src/app/medPluginGenerator/tests/CMakeLists.txt @@ -40,9 +40,9 @@ include_directories(${${PROJECT_NAME}_INCLUDE_DIRS} ## Add definitions ## ############################################################################# -add_definitions("-DCMAKE_DTK_DIR=\"${dtk_DIR}\"" - "-DCMAKE_ITK_DIR=\"${ITK_DIR}\"" - "-DCMAKE_RPI_DIR=\"${RPI_DIR}\"" +add_definitions("-DCMAKE_DTK_DIR=\"${dtk_ROOT}\"" + "-DCMAKE_ITK_DIR=\"${ITK_ROOT}\"" + "-DCMAKE_RPI_DIR=\"${RPI_ROOT}\"" "-DCMAKE_BINARY_DIR=\"${CMAKE_BINARY_DIR}\"" ) diff --git a/src/app/medPluginGenerator/tests/medPluginGeneratorTest.cpp b/src/app/medPluginGenerator/tests/medPluginGeneratorTest.cpp index a23005220c..57c23bc196 100644 --- a/src/app/medPluginGenerator/tests/medPluginGeneratorTest.cpp +++ b/src/app/medPluginGenerator/tests/medPluginGeneratorTest.cpp @@ -144,9 +144,9 @@ void medPluginGeneratorTest::testCompile() args.clear(); args << QString("-DMEDINRIA_DIR:PATH=%1").arg(CMAKE_BINARY_DIR) - << QString("-Ddtk_DIR:PATH=%1").arg(CMAKE_DTK_DIR) - << QString("-DITK_DIR:PATH=%1").arg(CMAKE_ITK_DIR) - << QString("-DRPI_DIR:PATH=%1").arg(CMAKE_RPI_DIR) + << QString("-Ddtk_ROOT:PATH=%1").arg(CMAKE_DTK_DIR) + << QString("-DITK_ROOT:PATH=%1").arg(CMAKE_ITK_DIR) + << QString("-DRPI_ROOT:PATH=%1").arg(CMAKE_RPI_DIR) << _tmpPath.absoluteFilePath(nameFirstLower); pGen.setWorkingDirectory(buildDir.absolutePath()); pGen.start("cmake", args); diff --git a/src/cmake/module/set_exe_install_rules.cmake b/src/cmake/module/set_exe_install_rules.cmake index 556255e7a1..2437782dad 100644 --- a/src/cmake/module/set_exe_install_rules.cmake +++ b/src/cmake/module/set_exe_install_rules.cmake @@ -62,7 +62,7 @@ if (APPLE) \${QT_BINARY_DIR}/macdeployqt \${CMAKE_INSTALL_PREFIX}/bin/${target}.app ) execute_process(COMMAND - \${dtk_DIR}/bin/dtkDeploy \${CMAKE_INSTALL_PREFIX}/bin/${target}.app -inject-dir=\${CMAKE_CURRENT_BINARY_DIR}/plugins + \${dtk_ROOT}/bin/dtkDeploy \${CMAKE_INSTALL_PREFIX}/bin/${target}.app -inject-dir=\${CMAKE_CURRENT_BINARY_DIR}/plugins ) ") endif() diff --git a/src/layers/legacy/medCoreLegacy/gui/settingsWidgets/medStartupSettingsWidget.cpp b/src/layers/legacy/medCoreLegacy/gui/settingsWidgets/medStartupSettingsWidget.cpp index 7fde169440..0b6673e74d 100644 --- a/src/layers/legacy/medCoreLegacy/gui/settingsWidgets/medStartupSettingsWidget.cpp +++ b/src/layers/legacy/medCoreLegacy/gui/settingsWidgets/medStartupSettingsWidget.cpp @@ -24,24 +24,12 @@ class medStartupSettingsWidgetPrivate { public: - QWidget *parent; QCheckBox *startInFullScreen; QComboBox *defaultStartingArea; QComboBox* theme; QComboBox *defaultSegmentationSpeciality; - - medStartupSettingsWidgetPrivate(); - ~medStartupSettingsWidgetPrivate(); }; -medStartupSettingsWidgetPrivate::medStartupSettingsWidgetPrivate() -{ -} - -medStartupSettingsWidgetPrivate::~medStartupSettingsWidgetPrivate() -{ -} - medStartupSettingsWidget::medStartupSettingsWidget(QWidget *parent) : medSettingsWidget(parent), d(new medStartupSettingsWidgetPrivate()) { setTabName(tr("Startup")); diff --git a/src/layers/legacy/medImageIO/CMakeLists.txt b/src/layers/legacy/medImageIO/CMakeLists.txt index 7b65c22aad..72cb5ebf9d 100644 --- a/src/layers/legacy/medImageIO/CMakeLists.txt +++ b/src/layers/legacy/medImageIO/CMakeLists.txt @@ -93,7 +93,7 @@ target_link_libraries(${TARGET_NAME} ITKIOMRC ITKIOTIFF ITKVTK - vtkIOImage + VTK::IOImage ${ITKIOPhilipsREC_LIBRARIES} ${DCMTK_LIBRARIES} ) diff --git a/src/layers/legacy/medLog/CMakeLists.txt b/src/layers/legacy/medLog/CMakeLists.txt index b5951457b5..0c2535460f 100644 --- a/src/layers/legacy/medLog/CMakeLists.txt +++ b/src/layers/legacy/medLog/CMakeLists.txt @@ -28,9 +28,9 @@ find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) # find vtk -find_package(VTK REQUIRED COMPONENTS vtkCommonCore) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES VTK::CommonCore) ## ############################################################################# ## List Sources @@ -73,7 +73,7 @@ target_link_libraries(${TARGET_NAME} dtkCoreSupport dtkLog ITKCommon - vtkCommonCore + VTK::CommonCore ) ## ############################################################################# diff --git a/src/layers/legacy/medUtilities/CMakeLists.txt b/src/layers/legacy/medUtilities/CMakeLists.txt index 61d4ee6bb7..80ce290399 100644 --- a/src/layers/legacy/medUtilities/CMakeLists.txt +++ b/src/layers/legacy/medUtilities/CMakeLists.txt @@ -22,8 +22,7 @@ set(TARGET_NAME medUtilities) find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) -find_package(VTK REQUIRED COMPONENTS vtkInteractionWidgets ) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS InteractionWidgets) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKGDCM ITKIOGDCM ITKThresholding) include(${ITK_USE_FILE}) @@ -71,6 +70,7 @@ target_link_libraries(${TARGET_NAME} medCoreLegacy medVtkInria medVtkDataMeshBase + VTK::InteractionWidgets ) diff --git a/src/layers/legacy/medVtkDataMeshBase/CMakeLists.txt b/src/layers/legacy/medVtkDataMeshBase/CMakeLists.txt index 76f37ded7d..022d91f09a 100644 --- a/src/layers/legacy/medVtkDataMeshBase/CMakeLists.txt +++ b/src/layers/legacy/medVtkDataMeshBase/CMakeLists.txt @@ -22,9 +22,8 @@ set(TARGET_NAME medVtkDataMeshBase) find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) - -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonDataModel vtkRenderingCore vtkRenderingVolumeOpenGL2 vtkInteractionStyle vtkInteractionWidgets vtkIOParallelXML vtkIOImage vtkIOGeometry vtkIOExport vtkRenderingContext2D vtkIOInfovis) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore CommonDataModel RenderingCore RenderingVolumeOpenGL2 + InteractionStyle InteractionWidgets IOParallelXML IOImage IOGeometry IOExport RenderingContext2D IOInfovis) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) @@ -63,12 +62,13 @@ target_include_directories(${TARGET_NAME} ## ############################################################################# target_link_libraries(${TARGET_NAME} - vtkIOInfovis + ${VTK_LIBRARIES} medCore medLog medVtkInria ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## install diff --git a/src/layers/legacy/medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx b/src/layers/legacy/medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx index a41382ca40..855e51109d 100644 --- a/src/layers/legacy/medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx +++ b/src/layers/legacy/medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx @@ -109,7 +109,7 @@ void vtkMetaSurfaceMesh::ReadVtkFile (const char* filename) else { vtkErrorMacro(<< "Can not read file with version > " << vtkLegacyReaderMajorVersion - << "." << vtkLegacyReaderMinorVersion << ": " << filename << endl) + << "." << vtkLegacyReaderMinorVersion << ": " << filename << endl); throw vtkErrorCode::FileFormatError; } } @@ -193,7 +193,7 @@ void vtkMetaSurfaceMesh::Read (const char* filename) this->ReadOBJFile (filename); break; default : - vtkErrorMacro(<<"unknown dataset type : "<DataSet) { - vtkErrorMacro(<<"No DataSet to write"<DataSet); if (!c_mesh) { - vtkErrorMacro(<<"DataSet is not a polydata object"<DataSet) { - vtkErrorMacro(<<"No DataSet to write"<DataSet); if (!c_mesh) { - vtkErrorMacro(<<"DataSet is not a polydata object"< " << vtkLegacyReaderMajorVersion - << "." << vtkLegacyReaderMinorVersion << ": " << filename << endl) + << "." << vtkLegacyReaderMinorVersion << ": " << filename << endl); throw vtkErrorCode::FileFormatError; } } @@ -158,7 +158,7 @@ void vtkMetaVolumeMesh::Read (const char* filename) this->ReadGMeshFile (filename); break; default : - vtkErrorMacro(<<"unknown dataset type : "<DataSet) { - vtkErrorMacro(<<"No DataSet to write"<DataSet); if (!c_mesh) { - vtkErrorMacro(<<"DataSet is not a polydata object"<DataSet) { - vtkErrorMacro(<<"No DataSet to write"<DataSet); if (!c_mesh) { - vtkErrorMacro(<<"DataSet is not a polydata object"<Delete(); cellarray->Delete(); outputmesh->Delete(); - vtkErrorMacro("No point in file\n") + vtkErrorMacro("No point in file\n"); throw vtkErrorCode::CannotOpenFileError; } file >> str; @@ -639,7 +639,7 @@ void vtkMetaVolumeMesh::ReadGMeshFile (const char* filename) pointarray->Delete(); cellarray->Delete(); outputmesh->Delete(); - vtkErrorMacro("No tetrahedron in file\n") + vtkErrorMacro("No tetrahedron in file\n"); throw vtkErrorCode::CannotOpenFileError; } file >> str; diff --git a/src/layers/legacy/medVtkInria/CMakeLists.txt b/src/layers/legacy/medVtkInria/CMakeLists.txt index f8041aca6d..66fb896f54 100644 --- a/src/layers/legacy/medVtkInria/CMakeLists.txt +++ b/src/layers/legacy/medVtkInria/CMakeLists.txt @@ -19,8 +19,8 @@ set(TARGET_NAME medVtkInria) ## Find required ## ############################################################################# -find_package(VTK REQUIRED COMPONENTS vtkRenderingVolumeOpenGL2 vtkInteractionWidgets vtkRenderingAnnotation vtkInteractionStyle vtkImagingStatistics vtkIOLegacy ) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS RenderingVolumeOpenGL2 InteractionWidgets RenderingAnnotation + InteractionStyle ImagingStatistics IOLegacy RenderingVolume IOImage FiltersGeometry ImagingColor) find_package(OpenGL REQUIRED) @@ -75,32 +75,11 @@ target_link_libraries(${TARGET_NAME} Qt5::Core Qt5::Widgets medCoreLegacy - vtkCommonCore - vtkCommonSystem - vtkImagingColor - vtkImagingGeneral - vtkImagingHybrid - vtkIOCore - vtkIOExportOpenGL2 - vtkIOGeometry - vtkIOImage - vtkIOLegacy - vtkIOXML - vtkRenderingAnnotation - vtkRenderingCore - vtkRenderingOpenGL2 - vtkRenderingVolumeOpenGL2 - vtkRenderingContextOpenGL2 ${VTK_OSPRAY_RENDERING_LIBRARY} - vtkInteractionWidgets - vtkInteractionStyle - vtkFiltersExtraction - vtkFiltersModeling - vtkImagingStencil - vtkFiltersGeometry - vtksys + ${VTK_LIBRARIES} ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## install diff --git a/src/layers/legacy/medVtkInria/vtkImageView/vtkAxes2DWidget.cxx b/src/layers/legacy/medVtkInria/vtkImageView/vtkAxes2DWidget.cxx index be0b3d97b3..86248d9185 100644 --- a/src/layers/legacy/medVtkInria/vtkImageView/vtkAxes2DWidget.cxx +++ b/src/layers/legacy/medVtkInria/vtkImageView/vtkAxes2DWidget.cxx @@ -36,7 +36,7 @@ #include #include #include - +#include vtkStandardNewMacro(vtkAxes2DWidget); diff --git a/src/layers/legacy/medVtkInria/vtkImageView/vtkImageView3D.cxx b/src/layers/legacy/medVtkInria/vtkImageView/vtkImageView3D.cxx index aa557fe7e6..bf69fd37a3 100644 --- a/src/layers/legacy/medVtkInria/vtkImageView/vtkImageView3D.cxx +++ b/src/layers/legacy/medVtkInria/vtkImageView/vtkImageView3D.cxx @@ -944,7 +944,8 @@ vtkSmartPointer vtkImageView3D::DataSetToActor(vtkPointSet* arg, vtkPr idFilter->PointIdsOn(); idFilter->CellIdsOn(); idFilter->FieldDataOn(); - idFilter->SetIdsArrayName("vtkOriginalIds"); + idFilter->SetCellIdsArrayName("vtkOriginalIds"); + idFilter->SetPointIdsArrayName("vtkOriginalIds"); idFilter->SetInputData(arg); geometryextractor->SetInputConnection(idFilter->GetOutputPort()); diff --git a/src/layers/legacy/medVtkInria/vtkVisuManagement/vtkTessellatedSphereSource.cxx b/src/layers/legacy/medVtkInria/vtkVisuManagement/vtkTessellatedSphereSource.cxx index be92a85f1f..b18cc40a7e 100644 --- a/src/layers/legacy/medVtkInria/vtkVisuManagement/vtkTessellatedSphereSource.cxx +++ b/src/layers/legacy/medVtkInria/vtkVisuManagement/vtkTessellatedSphereSource.cxx @@ -185,7 +185,7 @@ void TesselateTriangles(vtkPoints* oldVertices,vtkCellArray* oldTriangles, MidPointIds ids; vtkIdType numCellPts = 0; - vtkIdType* pts; + vtkIdType const *pts = nullptr; oldTriangles->InitTraversal(); for (int current2P=oldPoints;oldTriangles->GetNextCell(numCellPts,pts);) { @@ -220,17 +220,20 @@ void TesselateTriangles(vtkPoints* oldVertices,vtkCellArray* oldTriangles, vertices->SetPoint(current2P++,midPoint); } - // Add the triangles. + // Add the triangles + vtkIdType tmpPts[3]; + std::copy(pts, pts + 3, tmpPts); const vtkIdType c3 = 3; triangles->InsertNextCell(c3,triPointsIds); std::swap(triPointsIds[0],triPointsIds[1]); - std::swap(pts[0],pts[1]); + std::swap(tmpPts[0], tmpPts[1]); - for (int j=0;j<3;++j) { - std::swap(triPointsIds[j],pts[j]); - triangles->InsertNextCell(c3,triPointsIds); - std::swap(triPointsIds[j],pts[j]); + for (int j=0;j<3;++j) + { + std::swap(triPointsIds[j], tmpPts[j]); + triangles->InsertNextCell(c3, triPointsIds); + std::swap(triPointsIds[j], tmpPts[j]); } } } diff --git a/src/layers/medWidgets/toolboxes/medDiffusionSelectorToolBox.cpp b/src/layers/medWidgets/toolboxes/medDiffusionSelectorToolBox.cpp index d9c07d235e..240d8b8977 100644 --- a/src/layers/medWidgets/toolboxes/medDiffusionSelectorToolBox.cpp +++ b/src/layers/medWidgets/toolboxes/medDiffusionSelectorToolBox.cpp @@ -115,7 +115,7 @@ medDiffusionSelectorToolBox::medDiffusionSelectorToolBox(QWidget *parent, Select case Tractography: default: - labelTitle = tr("Tractography algorithm"); + labelTitle = tr("Tractography"); for(QString pluginKey : medCore::tractography::pluginFactory().keys()) { medAbstractProcess *process = medCore::tractography::pluginFactory().create(pluginKey); diff --git a/src/plugins/legacy/iterativeClosestPoint/CMakeLists.txt b/src/plugins/legacy/iterativeClosestPoint/CMakeLists.txt index 3ae6628fe5..3270331eb4 100644 --- a/src/plugins/legacy/iterativeClosestPoint/CMakeLists.txt +++ b/src/plugins/legacy/iterativeClosestPoint/CMakeLists.txt @@ -36,8 +36,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonDataModel vtkFiltersGeneral) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore CommonDataModel FiltersGeneral) ## ############################################################################# ## List Sources @@ -74,12 +73,14 @@ add_library(${TARGET_NAME} SHARED target_link_libraries(${TARGET_NAME} ${QT_LIBRARIES} - ${VTK_LIBRARIES} medCore medVtkInria medUtilities + ${VTK_LIBRARIES} ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ## ############################################################################# diff --git a/src/plugins/legacy/itkDataImage/limit/vtkLimitVectorsToVOI.cxx b/src/plugins/legacy/itkDataImage/limit/vtkLimitVectorsToVOI.cxx index be88d86623..d49c1fa17b 100644 --- a/src/plugins/legacy/itkDataImage/limit/vtkLimitVectorsToVOI.cxx +++ b/src/plugins/legacy/itkDataImage/limit/vtkLimitVectorsToVOI.cxx @@ -13,8 +13,16 @@ #include "vtkLimitVectorsToVOI.h" +#include +#include +#include +#include +#include +#include +#include #include #include +#include #include #include diff --git a/src/plugins/legacy/itkDataImage/tests/CMakeLists.txt b/src/plugins/legacy/itkDataImage/tests/CMakeLists.txt index 12ba586518..0fbb159385 100644 --- a/src/plugins/legacy/itkDataImage/tests/CMakeLists.txt +++ b/src/plugins/legacy/itkDataImage/tests/CMakeLists.txt @@ -38,8 +38,8 @@ create_test_sourcelist(${PROJECT_NAME}_TESTS ${PROJECT_NAME}.cxx ${${PROJECT_NAME}_TESTS_FILENAME} ) -if(ITK_DIR) - set(ITK_DATA_ROOT ${ITK_DIR}/Examples/Data) +if(ITK_ROOT) + set(ITK_DATA_ROOT ${ITK_ROOT}/Examples/Data) endif() if(MSVC_IDE) diff --git a/src/plugins/legacy/itkDataSHImage/CMakeLists.txt b/src/plugins/legacy/itkDataSHImage/CMakeLists.txt index ddcbbbb3ae..4a4cabf1a5 100644 --- a/src/plugins/legacy/itkDataSHImage/CMakeLists.txt +++ b/src/plugins/legacy/itkDataSHImage/CMakeLists.txt @@ -35,8 +35,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKIOImageBase ITKIOMeta ) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonExecutionModel vtkRenderingCore vtkInteractionWidgets) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonExecutionModel RenderingCore InteractionWidgets) if (APPLE OR WIN32) find_package(Boost REQUIRED) @@ -107,6 +106,7 @@ target_link_libraries(${TARGET_NAME} medLog medVtkInria medImageIO + ${VTK_LIBRARIES} ) diff --git a/src/plugins/legacy/itkDataSHImage/management/vtkSphericalHarmonicSource.h b/src/plugins/legacy/itkDataSHImage/management/vtkSphericalHarmonicSource.h index 4f162b96df..04dc18aed0 100644 --- a/src/plugins/legacy/itkDataSHImage/management/vtkSphericalHarmonicSource.h +++ b/src/plugins/legacy/itkDataSHImage/management/vtkSphericalHarmonicSource.h @@ -127,7 +127,7 @@ class vtkSphericalHarmonicSource: public vtkPolyDataAlgorithm { /** Set FlipVector On/Off If On, x direction is flipped in the * reconstruction directions defining the basis function*/ - vtkSetVector3Macro(FlipVector,const bool); + vtkSetVector3Macro(FlipVector, bool); /** Get FlipVector On/Off If On, x direction is flipped in the reconstruction * directions defining the basis function*/ diff --git a/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt b/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt index 33ae107785..63309cf1be 100644 --- a/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt +++ b/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt @@ -34,9 +34,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKIOImageBase ITKIOMeta ITKIONRRD ITKIONIFTI) include(${ITK_USE_FILE}) - -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonExecutionModel vtkRenderingCore vtkImagingCore vtkInteractionStyle vtkInteractionWidgets) -include(${VTK_USE_FILE}) + +find_package(VTK REQUIRED COMPONENTS CommonCore CommonExecutionModel RenderingCore ImagingCore InteractionStyle InteractionWidgets) find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) @@ -121,9 +120,9 @@ target_link_libraries(${TARGET_NAME} medCore medLog medVtkInria + ${VTK_LIBRARIES} ) - ## ############################################################################# ## Install rules ## ############################################################################# diff --git a/src/plugins/legacy/manualRegistration/CMakeLists.txt b/src/plugins/legacy/manualRegistration/CMakeLists.txt index 784fddf119..171b8437f7 100644 --- a/src/plugins/legacy/manualRegistration/CMakeLists.txt +++ b/src/plugins/legacy/manualRegistration/CMakeLists.txt @@ -36,8 +36,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKIOImageBase ITKTransform ITKIOTransformBase ITKIOTransformInsightLegacy ITKRegistrationCommon ITKIOMeta) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkInteractionWidgets) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore InteractionWidgets) find_package(RPI REQUIRED) include(${RPI_USE_FILE}) @@ -83,6 +82,7 @@ target_link_libraries(${TARGET_NAME} medCore medRegistration medVtkInria + ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/medCreateMeshFromMask/CMakeLists.txt b/src/plugins/legacy/medCreateMeshFromMask/CMakeLists.txt index 6bab2d2d61..ba27f75049 100644 --- a/src/plugins/legacy/medCreateMeshFromMask/CMakeLists.txt +++ b/src/plugins/legacy/medCreateMeshFromMask/CMakeLists.txt @@ -36,8 +36,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKVtkGlue) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore) ## ############################################################################# ## List Sources @@ -78,6 +77,7 @@ target_link_libraries(${TARGET_NAME} medVtkInria medUtilities ITKVtkGlue + VTK::CommonCore ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/medExportVideo/CMakeLists.txt b/src/plugins/legacy/medExportVideo/CMakeLists.txt index f3cbce4673..e88c5bc9cf 100644 --- a/src/plugins/legacy/medExportVideo/CMakeLists.txt +++ b/src/plugins/legacy/medExportVideo/CMakeLists.txt @@ -31,7 +31,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE) ## ############################################################################# if(${USE_FFmpeg}) - set (VTK_FFmpeg_MODULE vtkIOFFMPEG) + set (VTK_FFmpeg_MODULE IOFFMPEG) + set (VTK_FFmpeg_MODULE_LIB VTK::IOFFMPEG) add_definitions(-DMED_USE_FFmpeg) endif() @@ -41,8 +42,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkImagingSources ${VTK_FFmpeg_MODULE} vtkIOImage vtkRenderingQt vtkIOMovie) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore ImagingSources ${VTK_FFmpeg_MODULE} IOImage RenderingQt IOMovie) ## ############################################################################# ## List Sources @@ -83,13 +83,12 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities - vtkImagingSources - vtkIOImage - vtkIOMovie - vtkRenderingQt - ${VTK_FFmpeg_MODULE} + ${VTK_LIBRARIES} + ${VTK_FFmpeg_MODULE_LIB} ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ## ############################################################################# diff --git a/src/plugins/legacy/medRemeshing/CMakeLists.txt b/src/plugins/legacy/medRemeshing/CMakeLists.txt index 6a20e504dc..167e8e59ca 100644 --- a/src/plugins/legacy/medRemeshing/CMakeLists.txt +++ b/src/plugins/legacy/medRemeshing/CMakeLists.txt @@ -36,10 +36,9 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonDataModel vtkFiltersCore - vtkFiltersModeling vtkRenderingCore vtkInteractionStyle - vtkInteractionWidgets) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore CommonDataModel FiltersCore + FiltersModeling RenderingCore InteractionStyle + InteractionWidgets) ## ############################################################################# ## List Sources @@ -79,6 +78,7 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities + ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/medVtkFibersData/CMakeLists.txt b/src/plugins/legacy/medVtkFibersData/CMakeLists.txt index 216b17baf7..f1b568b1e1 100644 --- a/src/plugins/legacy/medVtkFibersData/CMakeLists.txt +++ b/src/plugins/legacy/medVtkFibersData/CMakeLists.txt @@ -32,8 +32,8 @@ add_definitions(-D${TARGET_NAME_UP}_VERSION="${${TARGET_NAME}_VERSION}") find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) -find_package(VTK REQUIRED COMPONENTS vtkImagingCore vtkIOLegacy vtkIOXML vtkRenderingCore vtkRenderingOpenGL2 vtkInteractionWidgets) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS ImagingCore IOLegacy IOXML RenderingCore RenderingOpenGL2 + InteractionWidgets CommonDataModel FiltersParallel) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKVtkGlue) include(${ITK_USE_FILE}) @@ -109,8 +109,10 @@ target_link_libraries(${TARGET_NAME} TTK::ITKTensor ITKCommon ITKVtkGlue + ${VTK_LIBRARIES} ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## Install rules diff --git a/src/plugins/legacy/medVtkFibersData/interactors/medVtkFibersDataInteractor.cpp b/src/plugins/legacy/medVtkFibersData/interactors/medVtkFibersDataInteractor.cpp index e28fa3f044..9e6bdac2cf 100644 --- a/src/plugins/legacy/medVtkFibersData/interactors/medVtkFibersDataInteractor.cpp +++ b/src/plugins/legacy/medVtkFibersData/interactors/medVtkFibersDataInteractor.cpp @@ -912,7 +912,7 @@ void medVtkFibersDataInteractor::bundleImageStatistics (const QString &bundleNam continue; vtkIdType npts = 0; - vtkIdType* ptids = 0; + vtkIdType const *ptids = nullptr; vtkIdType test = lines->GetNextCell (npts, ptids); double sumData = 0; @@ -992,7 +992,7 @@ void medVtkFibersDataInteractor::computeBundleLengthStatistics (const QString &n lines->InitTraversal(); vtkIdType npts = 0; - vtkIdType* ptids = 0; + vtkIdType const *ptids = nullptr; vtkIdType test = lines->GetNextCell (npts, ptids); double sumData = 0; diff --git a/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToROI.cxx b/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToROI.cxx index 63215d3d5f..4321574213 100644 --- a/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToROI.cxx +++ b/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToROI.cxx @@ -166,7 +166,7 @@ int vtkLimitFibersToROI::RequestData (vtkInformation *vtkNotUsed(request), lines->InitTraversal(); vtkIdType npts = 0; - vtkIdType* ptids = 0; + vtkIdType const *ptids = nullptr; vtkIdType test = lines->GetNextCell (npts, ptids); int cellId = 0; diff --git a/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToVOI.cxx b/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToVOI.cxx index e5b955ae31..83d105437b 100644 --- a/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToVOI.cxx +++ b/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToVOI.cxx @@ -94,7 +94,7 @@ int vtkLimitFibersToVOI::RequestData (vtkInformation *vtkNotUsed(request), vtkIdType npt = 0; - vtkIdType *pto = 0; + vtkIdType const *pto = nullptr; vtkIdType test = lines->GetNextCell (npt, pto); vtkIdType cellId = 0; diff --git a/src/plugins/legacy/medVtkFibersData/manager/vtkFiberPickerCallback.cpp b/src/plugins/legacy/medVtkFibersData/manager/vtkFiberPickerCallback.cpp index 9a7bb64dc2..65331cf68f 100644 --- a/src/plugins/legacy/medVtkFibersData/manager/vtkFiberPickerCallback.cpp +++ b/src/plugins/legacy/medVtkFibersData/manager/vtkFiberPickerCallback.cpp @@ -114,7 +114,8 @@ void vtkFiberPickerCallback::DeletePickedCell() } realLines->InitTraversal(); - vtkIdType rnpts, *rpto; + vtkIdType rnpts = 0; + vtkIdType const *rpto = nullptr; vtkIdType test = realLines->GetNextCell (rnpts, rpto); int cellid = 0; @@ -130,10 +131,17 @@ void vtkFiberPickerCallback::DeletePickedCell() if( i==npts && pto[i-1]==rpto[i-1]) { + // Avoid const* + vtkIdType *nonConstRpto = nullptr; + for (int j=0; jFiberImage->Modified(); diff --git a/src/plugins/legacy/medVtkFibersData/readers/vtkXMLFiberDataSetReader.cxx b/src/plugins/legacy/medVtkFibersData/readers/vtkXMLFiberDataSetReader.cxx index be1c6c5d97..013bab93dd 100644 --- a/src/plugins/legacy/medVtkFibersData/readers/vtkXMLFiberDataSetReader.cxx +++ b/src/plugins/legacy/medVtkFibersData/readers/vtkXMLFiberDataSetReader.cxx @@ -26,6 +26,7 @@ #include "vtkInformationVector.h" #include #include +#include vtkStandardNewMacro(vtkXMLFiberDataSetReader); diff --git a/src/plugins/legacy/medVtkView/CMakeLists.txt b/src/plugins/legacy/medVtkView/CMakeLists.txt index d853feb02f..d88b7d0e20 100644 --- a/src/plugins/legacy/medVtkView/CMakeLists.txt +++ b/src/plugins/legacy/medVtkView/CMakeLists.txt @@ -32,8 +32,7 @@ add_definitions(-D${TARGET_NAME_UP}_VERSION="${${TARGET_NAME}_VERSION}") find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) -find_package(VTK REQUIRED COMPONENTS vtkGUISupportQt vtkInteractionWidgets) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS InteractionWidgets GUISupportQt) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) @@ -83,11 +82,11 @@ target_link_libraries(${TARGET_NAME} dtkLog medCore medVtkInria - vtkGUISupportQt - vtkGUISupportQtOpenGL medVtkDataMeshBase + ${VTK_LIBRARIES} ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## Install rules diff --git a/src/plugins/legacy/medVtkView/medVtkView.cpp b/src/plugins/legacy/medVtkView/medVtkView.cpp index b8e5a2c1c7..71378e2cb7 100644 --- a/src/plugins/legacy/medVtkView/medVtkView.cpp +++ b/src/plugins/legacy/medVtkView/medVtkView.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include @@ -64,7 +64,7 @@ class medVtkViewPrivate vtkImageView3D *view3d; vtkGenericOpenGLRenderWindow *renWin; - QVTKOpenGLWidget *viewWidget; + QVTKOpenGLNativeWidget *viewWidget; medVtkViewObserver *observer; @@ -127,9 +127,9 @@ medVtkView::medVtkView(QObject* parent): medAbstractImageView(parent), d->view3d->SetInteractorStyle(interactorStyle); interactorStyle->Delete(); - d->viewWidget = new QVTKOpenGLWidget(); + d->viewWidget = new QVTKOpenGLNativeWidget(); d->viewWidget->setEnableHiDPI(true); - d->viewWidget->SetRenderWindow(d->renWin); + d->viewWidget->setRenderWindow(d->renWin); // Event filter used to know if the view is selected or not d->viewWidget->installEventFilter(this); diff --git a/src/plugins/legacy/meshManipulation/CMakeLists.txt b/src/plugins/legacy/meshManipulation/CMakeLists.txt index 3607f38212..c006f16ffd 100644 --- a/src/plugins/legacy/meshManipulation/CMakeLists.txt +++ b/src/plugins/legacy/meshManipulation/CMakeLists.txt @@ -36,9 +36,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkRenderingCore vtkInteractionStyle - vtkInteractionWidgets) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore RenderingCore InteractionStyle InteractionWidgets) ## ############################################################################# ## List Sources @@ -78,6 +76,7 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities + ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/meshMapping/CMakeLists.txt b/src/plugins/legacy/meshMapping/CMakeLists.txt index e5680c4df1..3e1ec39a4b 100644 --- a/src/plugins/legacy/meshMapping/CMakeLists.txt +++ b/src/plugins/legacy/meshMapping/CMakeLists.txt @@ -36,8 +36,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKVtkGlue) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkImagingCore vtkImagingGeneral vtkFiltersCore vtkFiltersGeneral) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore ImagingCore ImagingGeneral FiltersCore FiltersGeneral) ## ############################################################################# ## List Sources @@ -78,6 +77,7 @@ target_link_libraries(${TARGET_NAME} medVtkInria medUtilities ITKVtkGlue + ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/meshMapping/meshMapping.cpp b/src/plugins/legacy/meshMapping/meshMapping.cpp index cbef3dc577..59aca1afa6 100644 --- a/src/plugins/legacy/meshMapping/meshMapping.cpp +++ b/src/plugins/legacy/meshMapping/meshMapping.cpp @@ -10,30 +10,20 @@ PURPOSE. =========================================================================*/ -#include +#include "meshMapping.h" -#include #include -#include #include -#include #include -#include -#include -#include -#include +#include #include #include #include +#include #include #include -#include -#include -#include - -#include // ///////////////////////////////////////////////////////////////// // meshMappingPrivate @@ -48,77 +38,56 @@ class meshMappingPrivate template int mapImageOnMesh() { - typedef itk::Image ImageType; - if ( !data ||!data->data() || !structure ||!structure->data()) { return medAbstractProcessLegacy::FAILURE; } - //Converting the mesh + // Get the mesh polydata and create an output polydata if(!structure->identifier().contains("vtkDataMesh")) { return medAbstractProcessLegacy::MESH_TYPE; } - vtkMetaDataSet *structureDataset = static_cast(structure->data()); vtkPolyData *structurePolydata = static_cast(structureDataset->GetDataSet()); + vtkSmartPointer structurePolydataCopy = vtkSmartPointer::New(); + structurePolydataCopy->DeepCopy(structurePolydata); - // Converting the image - typedef itk::ImageToVTKImageFilter FilterType; - typename FilterType::Pointer filter = FilterType::New(); + // Get the ITK data + using ImageType = itk::Image; typename ImageType::Pointer img = static_cast(data->data()); - filter->SetInput(img); - filter->Update(); - // ----- Hack to keep the itkImages info (origin and orientation) - vtkMatrix4x4 *matrix = vtkMatrix4x4::New(); - matrix->Identity(); - for (unsigned int x=0; x<3; x++) - { - for (unsigned int y=0; y<3; y++) + // Create a new point data array for the interpolated values + vtkSmartPointer interpolatedValues = vtkSmartPointer::New(); + interpolatedValues->SetName("MappedValues"); + interpolatedValues->SetNumberOfComponents(1); + interpolatedValues->SetNumberOfTuples(structurePolydataCopy->GetNumberOfPoints()); + + // Fill the data array of points from the VTK with values from the ITK data + typename ImageType::IndexType itkIndex; + typename ImageType::PointType itkPoint; + double point[3]; + vtkPoints* points = structurePolydataCopy->GetPoints(); + for (vtkIdType i = 0; i < structurePolydataCopy->GetNumberOfPoints(); ++i) + { + points->GetPoint(i, point); + for (int d = 0; d < 3; ++d) { - matrix->SetElement(x, y, img->GetDirection()[x][y]); + itkPoint[d] = point[d]; + } + + itkIndex = img->TransformPhysicalPointToIndex(itkPoint); + typename ImageType::PixelType pixelValue = img->GetPixel(itkIndex); + if (!std::isnan(static_cast(pixelValue))) + { + interpolatedValues->SetValue(i, static_cast(pixelValue)); } } - typename itk::ImageBase<3>::PointType origin = img->GetOrigin(); - double v_origin[4], v_origin2[4]; - for (int i=0; i<3; i++) - { - v_origin[i] = origin[i]; - } - v_origin[3] = 1.0; - matrix->MultiplyPoint (v_origin, v_origin2); - for (int i=0; i<3; i++) - { - matrix->SetElement (i, 3, v_origin[i]-v_origin2[i]); - } - //------------------------------------------------------ - - vtkImageData *vtkImage = filter->GetOutput(); - - vtkImageCast *cast = vtkImageCast::New(); - cast->SetInputData(vtkImage); - cast->SetOutputScalarTypeToFloat(); - - //To get the itkImage infos back - vtkSmartPointer t = vtkSmartPointer::New(); - t->SetMatrix(matrix); - - vtkSmartPointer transformFilter = vtkSmartPointer::New(); - transformFilter->SetInputConnection(cast->GetOutputPort()); - transformFilter->SetTransform(t); - - // Probe magnitude with iso-surface. - vtkProbeFilter *probe = vtkProbeFilter::New(); - probe->SetInputData(structurePolydata); - probe->SetSourceConnection(transformFilter->GetOutputPort()); - probe->SpatialMatchOn(); - probe->Update(); - vtkPolyData *polydata = probe->GetPolyDataOutput(); + structurePolydataCopy->GetPointData()->SetScalars(interpolatedValues); + // Create output vtkMetaSurfaceMesh *smesh = vtkMetaSurfaceMesh::New(); - smesh->SetDataSet(polydata); + smesh->SetDataSet(structurePolydataCopy); output = medAbstractDataFactory::instance()->createSmartPointer("vtkDataMesh"); output->setData(smesh); @@ -221,11 +190,6 @@ void meshMapping::setInput(medAbstractData *data, int channel) } } -void meshMapping::setParameter(double data, int channel) -{ - // Here comes a switch over channel to handle parameters -} - int meshMapping::update() { int res = medAbstractProcessLegacy::FAILURE; diff --git a/src/plugins/legacy/meshMapping/meshMapping.h b/src/plugins/legacy/meshMapping/meshMapping.h index a01686b6a9..120ade46ef 100644 --- a/src/plugins/legacy/meshMapping/meshMapping.h +++ b/src/plugins/legacy/meshMapping/meshMapping.h @@ -38,9 +38,6 @@ public slots: //! Input data to the plugin is set through here void setInput(medAbstractData *data, int channel); - - //! Parameters are set through here, channel allows to handle multiple parameters - void setParameter(double data, int channel); //! Method to actually start the filter int update(); @@ -48,7 +45,6 @@ public slots: //! The output will be available through here medAbstractData *output(); - private: meshMappingPrivate *d; }; diff --git a/src/plugins/legacy/polygonRoi/CMakeLists.txt b/src/plugins/legacy/polygonRoi/CMakeLists.txt index e1aa88a447..faf07c2f22 100644 --- a/src/plugins/legacy/polygonRoi/CMakeLists.txt +++ b/src/plugins/legacy/polygonRoi/CMakeLists.txt @@ -39,8 +39,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKImageLabel ITKVtkGlue ITKIOImageBase ITKIOMeta) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkGUISupportQt vtkCommonCore vtkIOLegacy) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS GUISupportQt CommonCore IOLegacy) find_package(Qt5 REQUIRED COMPONENTS Gui) @@ -93,9 +92,11 @@ target_link_libraries(${TARGET_NAME} medRegistration medVtkInria medUtilities - vtkCommonComputationalGeometry + ${VTK_LIBRARIES} ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ## ############################################################################# diff --git a/src/plugins/legacy/reformat/CMakeLists.txt b/src/plugins/legacy/reformat/CMakeLists.txt index 15be99de99..076b2bc6f2 100644 --- a/src/plugins/legacy/reformat/CMakeLists.txt +++ b/src/plugins/legacy/reformat/CMakeLists.txt @@ -36,8 +36,7 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKImageGrid ITKVtkGlue) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkGUISupportQt vtkInteractionWidgets vtkInteractionImage) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS InteractionWidgets InteractionImage GUISupportQt) ## ############################################################################# ## List Sources @@ -79,11 +78,11 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities - vtkInteractionImage - vtkGUISupportQt - vtkGUISupportQtOpenGL + ${VTK_LIBRARIES} ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ## ############################################################################# diff --git a/src/plugins/legacy/reformat/medResliceViewer.cpp b/src/plugins/legacy/reformat/medResliceViewer.cpp index 56003b649a..6b8af747f6 100644 --- a/src/plugins/legacy/reformat/medResliceViewer.cpp +++ b/src/plugins/legacy/reformat/medResliceViewer.cpp @@ -10,6 +10,7 @@ PURPOSE. =========================================================================*/ + #include "medResliceViewer.h" #include "resampleProcess.h" @@ -27,11 +28,8 @@ #include #include #include -#include #include #include -#include -#include #include #include #include @@ -40,7 +38,7 @@ #include #include #include -#include +#include #include #include @@ -69,25 +67,25 @@ class medResliceCursorCallback : public vtkCommand } } - vtkImagePlaneWidget *ipw = dynamic_cast< vtkImagePlaneWidget* >(caller); + vtkImagePlaneWidget *ipw = dynamic_cast(caller); if (ipw) { double *wl = static_cast(callData); - if (ipw == reformatViewer->getImagePlaneWidget(0)) + if (ipw == IPW[0]) { - reformatViewer->getImagePlaneWidget(1)->SetWindowLevel(wl[0],wl[1],1); - reformatViewer->getImagePlaneWidget(2)->SetWindowLevel(wl[0],wl[1],1); + IPW[1]->SetWindowLevel(wl[0], wl[1], 1); + IPW[2]->SetWindowLevel(wl[0], wl[1], 1); } - else if(ipw == reformatViewer->getImagePlaneWidget(1)) + else if (ipw == IPW[1]) { - reformatViewer->getImagePlaneWidget(0)->SetWindowLevel(wl[0],wl[1],1); - reformatViewer->getImagePlaneWidget(2)->SetWindowLevel(wl[0],wl[1],1); + IPW[0]->SetWindowLevel(wl[0], wl[1], 1); + IPW[2]->SetWindowLevel(wl[0], wl[1], 1); } - else if (ipw == reformatViewer->getImagePlaneWidget(2)) + else if (ipw == IPW[2]) { - reformatViewer->getImagePlaneWidget(0)->SetWindowLevel(wl[0],wl[1],1); - reformatViewer->getImagePlaneWidget(1)->SetWindowLevel(wl[0],wl[1],1); + IPW[0]->SetWindowLevel(wl[0], wl[1], 1); + IPW[1]->SetWindowLevel(wl[0], wl[1], 1); } } @@ -98,28 +96,27 @@ class medResliceCursorCallback : public vtkCommand // Although the return value is not used, we keep the get calls // in case they had side-effects rep->GetResliceCursorActor()->GetCursorAlgorithm()->GetResliceCursor(); - for (int i = 0; i < 3; i++) { - vtkPlaneSource *ps = static_cast< vtkPlaneSource * >(reformatViewer->getImagePlaneWidget(i)->GetPolyDataAlgorithm()); - ps->SetOrigin(reformatViewer->getResliceImageViewer(i)->GetResliceCursorWidget() - ->GetResliceCursorRepresentation()->GetPlaneSource()->GetOrigin()); - ps->SetPoint1(reformatViewer->getResliceImageViewer(i)->GetResliceCursorWidget() - ->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint1()); - ps->SetPoint2(reformatViewer->getResliceImageViewer(i)->GetResliceCursorWidget() - ->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint2()); + vtkPlaneSource *ps = static_cast(IPW[i]->GetPolyDataAlgorithm()); + ps->SetOrigin( + RCW[i]->GetResliceCursorRepresentation()->GetPlaneSource()->GetOrigin()); + ps->SetPoint1( + RCW[i]->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint1()); + ps->SetPoint2( + RCW[i]->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint2()); // If the reslice plane has modified, update it on the 3D widget - reformatViewer->getImagePlaneWidget(i)->UpdatePlacement(); + IPW[i]->UpdatePlacement(); } } // Render everything for (int i = 0; i < 3; i++) { - reformatViewer->getResliceImageViewer(i)->GetResliceCursorWidget()->Render(); + RCW[i]->Render(); } - reformatViewer->getImagePlaneWidget(0)->GetInteractor()->GetRenderWindow()->Render(); + IPW[0]->GetInteractor()->GetRenderWindow()->Render(); } ~medResliceCursorCallback() @@ -127,6 +124,10 @@ class medResliceCursorCallback : public vtkCommand reformatViewer = nullptr; } + medResliceCursorCallback() = default; + + vtkImagePlaneWidget* IPW[3]; + vtkResliceCursorWidget* RCW[3]; medResliceViewer *reformatViewer; }; @@ -160,14 +161,13 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA riw[i] = vtkSmartPointer::New(); vtkNew renderWindow; riw[i]->SetRenderWindow(renderWindow); - riw[i]->GetRenderer()->SetBackground(0,0,0); // black background } riw[selectedView]->GetRenderer()->SetBackground(0.3,0,0); // Build views for (int i = 0; i < 4; i++) { - views[i] = new QVTKOpenGLWidget(); + views[i] = new QVTKOpenGLNativeWidget(); views[i]->setEnableHiDPI(true); views[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); views[i]->installEventFilter(this); @@ -190,32 +190,37 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA viewBody->setLayout(gridLayout); // Share render windows and interactors - views[0]->SetRenderWindow(riw[0]->GetRenderWindow()); - riw[0]->SetupInteractor(views[0]->GetRenderWindow()->GetInteractor()); + views[0]->setRenderWindow(riw[0]->GetRenderWindow()); + riw[0]->SetupInteractor(views[0]->renderWindow()->GetInteractor()); - views[1]->SetRenderWindow(riw[1]->GetRenderWindow()); - riw[1]->SetupInteractor(views[1]->GetRenderWindow()->GetInteractor()); + views[1]->setRenderWindow(riw[1]->GetRenderWindow()); + riw[1]->SetupInteractor(views[1]->renderWindow()->GetInteractor()); - views[2]->SetRenderWindow(riw[2]->GetRenderWindow()); - riw[2]->SetupInteractor(views[2]->GetRenderWindow()->GetInteractor()); + views[2]->setRenderWindow(riw[2]->GetRenderWindow()); + riw[2]->SetupInteractor(views[2]->renderWindow()->GetInteractor()); vtkSmartPointer ren = vtkSmartPointer::New(); vtkNew renderWindow; - views[3]->SetRenderWindow(renderWindow); - views[3]->GetRenderWindow()->AddRenderer(ren); + views[3]->setRenderWindow(renderWindow); + views[3]->renderWindow()->AddRenderer(ren); // Make them all share the same reslice cursor object. for (int i = 0; i < 3; i++) { vtkResliceCursorLineRepresentation *rep = vtkResliceCursorLineRepresentation::SafeDownCast( - riw[i]->GetResliceCursorWidget()->GetRepresentation()); + riw[i]->GetResliceCursorWidget()->GetRepresentation()); riw[i]->SetResliceCursor(riw[selectedView]->GetResliceCursor()); rep->GetResliceCursorActor()->GetCursorAlgorithm()->SetReslicePlaneNormal(i); - riw[i]->SetInputData(vtkViewData); riw[i]->SetSliceOrientation(i); riw[i]->SetResliceModeToOblique(); + + // Due to a bug since ~VTK9 https://gitlab.kitware.com/vtk/vtk/-/issues/18441 + // the plans are not displayed correctly. A temporary solution is to use a wireframe representation. + rep->GetResliceCursorActor()->GetCenterlineProperty(0)->SetRepresentationToWireframe(); + rep->GetResliceCursorActor()->GetCenterlineProperty(1)->SetRepresentationToWireframe(); + rep->GetResliceCursorActor()->GetCenterlineProperty(2)->SetRepresentationToWireframe(); } vtkSmartPointer picker = vtkSmartPointer::New(); @@ -223,7 +228,7 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA vtkSmartPointer ipwProp = vtkSmartPointer::New(); - vtkRenderWindowInteractor *iren = views[3]->GetInteractor(); + vtkRenderWindowInteractor *iren = views[3]->interactor(); // Build planes on views for (int i = 0; i < 3; i++) @@ -241,7 +246,7 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA planeWidget[i]->SetTexturePlaneProperty(ipwProp); planeWidget[i]->TextureInterpolateOff(); planeWidget[i]->SetResliceInterpolateToLinear(); - planeWidget[i]->SetInputData(vtkViewData); + planeWidget[i]->SetInputConnection(view3d->GetInputAlgorithm(view3d->GetCurrentLayer())->GetOutputPort()); planeWidget[i]->SetPlaneOrientation(i); planeWidget[i]->SetSliceIndex(imageDims[i]/2); planeWidget[i]->DisplayTextOn(); @@ -255,25 +260,30 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA for (int i = 0; i < 3; i++) { + cbk->IPW[i] = planeWidget[i]; + cbk->RCW[i] = riw[i]->GetResliceCursorWidget(); + riw[i]->GetResliceCursorWidget()->AddObserver(vtkResliceCursorWidget::ResliceAxesChangedEvent, cbk); riw[i]->GetResliceCursorWidget()->AddObserver(vtkResliceCursorWidget::WindowLevelEvent, cbk); riw[i]->GetResliceCursorWidget()->AddObserver(vtkResliceCursorWidget::ResliceThicknessChangedEvent, cbk); riw[i]->GetResliceCursorWidget()->AddObserver(vtkResliceCursorWidget::ResetCursorEvent, cbk); riw[i]->GetInteractorStyle()->AddObserver(vtkCommand::WindowLevelEvent, cbk); - riw[i]->GetInteractorStyle()->AddObserver(vtkCommand::MouseMoveEvent, cbk); // Make them all share the same color map. riw[i]->SetLookupTable(riw[selectedView]->GetLookupTable()); - riw[i]->SetColorLevel(view3d->GetColorLevel()); - riw[i]->SetColorWindow(view3d->GetColorWindow()); planeWidget[i]->GetColorMap()->SetLookupTable(riw[selectedView]->GetLookupTable()); planeWidget[i]->SetColorMap(riw[i]->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetColorMap()); + + // Get back and apply the color level and color window from the original view + riw[i]->SetColorLevel(view3d->GetColorLevel()); + riw[i]->SetColorWindow(view3d->GetColorWindow()); } resetViews(); applyRadiologicalConvention(); updatePlaneNormals(); + // Turn the 3D view in the radiological convention planeWidget[0]->GetCurrentRenderer()->ResetCamera(); planeWidget[0]->GetCurrentRenderer()->GetActiveCamera()->Azimuth(180); planeWidget[0]->GetCurrentRenderer()->GetActiveCamera()->Roll(180); @@ -311,46 +321,10 @@ void medResliceViewer::thickMode(int val) for (int i = 0; i < 3; i++) { riw[i]->SetThickMode(val); - riw[i]->GetRenderer()->ResetCamera(); riw[i]->Render(); } } -void medResliceViewer::blendMode(int val) -{ - if (val) - { - SetBlendModeToMinIP(); - } -} - -void medResliceViewer::SetBlendMode(int m) -{ - for (int i = 0; i < 3; i++) - { - vtkImageSlabReslice *thickSlabReslice = vtkImageSlabReslice::SafeDownCast( - vtkResliceCursorThickLineRepresentation::SafeDownCast( - riw[i]->GetResliceCursorWidget()->GetRepresentation())->GetReslice()); - thickSlabReslice->SetBlendMode(m); - riw[i]->Render(); - } -} - -void medResliceViewer::SetBlendModeToMaxIP() -{ - this->SetBlendMode(VTK_IMAGE_SLAB_MAX); -} - -void medResliceViewer::SetBlendModeToMinIP() -{ - this->SetBlendMode(VTK_IMAGE_SLAB_MIN); -} - -void medResliceViewer::SetBlendModeToMeanIP() -{ - this->SetBlendMode(VTK_IMAGE_SLAB_MEAN); -} - void medResliceViewer::reset() { resetViews(); @@ -373,8 +347,8 @@ void medResliceViewer::render() for (int i = 0; i < 3; i++) { riw[i]->Render(); - views[i]->GetRenderWindow()->Render(); } + views[2]->renderWindow()->Render(); } void medResliceViewer::saveImage() @@ -499,7 +473,7 @@ void medResliceViewer::extentChanged(int val) bool medResliceViewer::eventFilter(QObject *object, QEvent *event) { - if (!qobject_cast(object)) + if (!qobject_cast(object)) { return true; } @@ -544,14 +518,15 @@ dtkSmartPointer medResliceViewer::getOutput() void medResliceViewer::applyRadiologicalConvention() { double normal[3]; - - getResliceImageViewer(0)->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetResliceCursor()->GetPlane(2)->GetNormal(normal); + auto resliceCursor = getResliceImageViewer(0)->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetResliceCursor(); + resliceCursor->GetPlane(2)->GetNormal(normal); for (int i = 0; i < 3; i++) { normal[i] = -normal[i]; } - getResliceImageViewer(0)->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetResliceCursor()->GetPlane(2)->SetNormal(normal); - getResliceImageViewer(0)->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetResliceCursor()->Update(); + resliceCursor->GetPlane(2)->SetNormal(normal); + resliceCursor->Update(); + for (int i = 0; i < 3; i++) { getResliceImageViewer(i)->GetResliceCursorWidget()->Render(); diff --git a/src/plugins/legacy/reformat/medResliceViewer.h b/src/plugins/legacy/reformat/medResliceViewer.h index e0d807a128..1940cd9a62 100644 --- a/src/plugins/legacy/reformat/medResliceViewer.h +++ b/src/plugins/legacy/reformat/medResliceViewer.h @@ -12,6 +12,7 @@ PURPOSE. =========================================================================*/ + #include "resliceToolBox.h" #include @@ -21,7 +22,7 @@ PURPOSE. #include -#include +#include #include #include @@ -53,11 +54,6 @@ class medResliceViewer : public medAbstractView public slots: virtual void thickMode(int); - virtual void blendMode(int); - virtual void SetBlendModeToMaxIP(); - virtual void SetBlendModeToMinIP(); - virtual void SetBlendModeToMeanIP(); - virtual void SetBlendMode(int); virtual void reset(); virtual void resetViews(); virtual void render(); @@ -83,7 +79,7 @@ public slots: vtkSmartPointer planeWidget[3]; double planeNormal[3][3]; QWidget *viewBody; - QVTKOpenGLWidget *views[4]; + QVTKOpenGLNativeWidget *views[4]; dtkSmartPointer inputData; std::array outputSpacingOrSize; unsigned char selectedView; diff --git a/src/plugins/legacy/variationalSegmentation/CMakeLists.txt b/src/plugins/legacy/variationalSegmentation/CMakeLists.txt index 2c6b6f9707..e19ccc8557 100644 --- a/src/plugins/legacy/variationalSegmentation/CMakeLists.txt +++ b/src/plugins/legacy/variationalSegmentation/CMakeLists.txt @@ -37,8 +37,7 @@ find_package(ITK REQUIRED COMPONENTS ITKCommon ITKImageFilterBase ITKThresholdin ITKVtkGlue) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkInteractionWidgets vtkRenderingCore) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore InteractionWidgets RenderingCore) ## ############################################################################# ## List Sources @@ -80,6 +79,7 @@ target_link_libraries(${TARGET_NAME} medUtilities ITKVTK ITKTransform + ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/voiCutter/CMakeLists.txt b/src/plugins/legacy/voiCutter/CMakeLists.txt index 6820fd5141..1a42780da2 100644 --- a/src/plugins/legacy/voiCutter/CMakeLists.txt +++ b/src/plugins/legacy/voiCutter/CMakeLists.txt @@ -36,9 +36,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkRenderingCore vtkCommonDataModel - vtkInteractionStyle vtkInteractionWidgets) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore RenderingCore CommonDataModel + InteractionStyle InteractionWidgets) ## ############################################################################# ## List Sources @@ -78,6 +77,7 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities + ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/vtkDataMesh/CMakeLists.txt b/src/plugins/legacy/vtkDataMesh/CMakeLists.txt index b792cb2363..c6dfc9e6b9 100644 --- a/src/plugins/legacy/vtkDataMesh/CMakeLists.txt +++ b/src/plugins/legacy/vtkDataMesh/CMakeLists.txt @@ -31,8 +31,8 @@ add_definitions(-D${TARGET_NAME_UP}_VERSION="${${TARGET_NAME}_VERSION}") find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) -find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonDataModel vtkRenderingCore vtkRenderingVolumeOpenGL2 vtkInteractionStyle vtkInteractionWidgets vtkIOParallelXML vtkIOImage vtkIOGeometry vtkIOExport vtkRenderingContext2D) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS CommonCore CommonDataModel RenderingCore RenderingVolumeOpenGL2 + InteractionStyle InteractionWidgets IOParallelXML IOImage IOGeometry IOExport RenderingContext2D) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) @@ -100,12 +100,11 @@ target_link_libraries(${TARGET_NAME} medCore medLog medVtkInria - vtkIOXML - vtkIOCore - vtkIOLegacy medVtkDataMeshBase + ${VTK_LIBRARIES} ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## Install rules diff --git a/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt b/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt index 35ace7785b..4d521c9797 100644 --- a/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt +++ b/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt @@ -6,8 +6,7 @@ set(TARGET_NAME ttkTensorScalarMapsProcessPlugin) find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) -find_package(VTK REQUIRED COMPONENTS vtkRenderingCore) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED COMPONENTS RenderingCore) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) @@ -58,9 +57,11 @@ target_link_libraries(${TARGET_NAME} medCoreLegacy medVtkInria medWidgets - vtkRenderingCore + VTK::RenderingCore ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) + ## ################################################################# ## Install rules ## ################################################################# diff --git a/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt b/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt index 13314d64e2..48ab64b95d 100644 --- a/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt +++ b/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt @@ -26,13 +26,13 @@ add_definitions(-D${TARGET_NAME_UP}_VERSION="${${TARGET_NAME}_VERSION}") ## Resolve dependencies ## ############################################################################# -find_package(VTK REQUIRED vtkCommonCore vtkCommonDataModel) -include(${VTK_USE_FILE}) +find_package(VTK REQUIRED CommonCore CommonDataModel) find_package(ITK REQUIRED ITKCommon ITKTransform ITKImageFunction) include(${ITK_USE_FILE}) find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) + ## ############################################################################# ## List Sources ## ############################################################################# @@ -80,9 +80,11 @@ target_link_libraries(${TARGET_NAME} medCoreLegacy medVtkInria medWidgets - vtkRenderingCore + ${VTK_LIBRARIES} ) +vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) + ## ################################################################# ## Install rules ## ################################################################# diff --git a/superbuild/patches/VTK.patch b/superbuild/patches/VTK.patch deleted file mode 100644 index 2ba761e78c..0000000000 --- a/superbuild/patches/VTK.patch +++ /dev/null @@ -1,193 +0,0 @@ -diff --git a/CMake/VTKGenerateExportHeader.cmake b/CMake/VTKGenerateExportHeader.cmake -index 9a7a76386e..f71969ae54 100644 ---- a/CMake/VTKGenerateExportHeader.cmake -+++ b/CMake/VTKGenerateExportHeader.cmake -@@ -174,8 +174,12 @@ macro(_vtk_test_compiler_hidden_visibility) - execute_process(COMMAND ${CMAKE_C_COMPILER} --version - OUTPUT_VARIABLE _gcc_version_info - ERROR_VARIABLE _gcc_version_info) -- string(REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*" -+ string(REGEX MATCH "[1-9][0-9]\\.[0-9]\\.[0-9]*" - _gcc_version "${_gcc_version_info}") -+ if(NOT _gcc_version) -+ string(REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*" -+ _gcc_version "${_gcc_version_info}") -+ endif() - # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the - # patch level, handle this here: - if(NOT _gcc_version) -diff --git a/IO/Movie/module.cmake b/IO/Movie/module.cmake -index fd6d096384..071b4a20a2 100644 ---- a/IO/Movie/module.cmake -+++ b/IO/Movie/module.cmake -@@ -20,4 +20,5 @@ vtk_module(vtkIOMovie - vtkCommonDataModel - vtkCommonMisc - vtkCommonSystem -+ vtksys - ) -\ No newline at end of file -diff --git a/IO/Movie/vtkOggTheoraWriter.cxx b/IO/Movie/vtkOggTheoraWriter.cxx -index d24acde998..9dff50bb0e 100644 ---- a/IO/Movie/vtkOggTheoraWriter.cxx -+++ b/IO/Movie/vtkOggTheoraWriter.cxx -@@ -21,6 +21,8 @@ - - #include "vtk_oggtheora.h" - -+#include -+ - #include - - //--------------------------------------------------------------------------- -@@ -190,7 +192,7 @@ int vtkOggTheoraWriterInternal::Start() - th_info_clear(&thInfo); - - // Finally, open the file and start it off. -- this->outFile = fopen(this->Writer->GetFileName(),"wb"); -+ this->outFile = vtksys::SystemTools::Fopen(this->Writer->GetFileName(),"wb"); - if (!this->outFile) - { - vtkGenericWarningMacro(<< "Could not open " << this->Writer->GetFileName() << "." ); -diff --git a/Rendering/Qt/vtkQtLabelRenderStrategy.cxx b/Rendering/Qt/vtkQtLabelRenderStrategy.cxx -index 8bfd3f6b6b..2d5adb1834 100644 ---- a/Rendering/Qt/vtkQtLabelRenderStrategy.cxx -+++ b/Rendering/Qt/vtkQtLabelRenderStrategy.cxx -@@ -40,6 +40,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/Rendering/Qt/vtkQtStringToImage.cxx b/Rendering/Qt/vtkQtStringToImage.cxx -index 549ffbe874..a7c726e4f9 100644 ---- a/Rendering/Qt/vtkQtStringToImage.cxx -+++ b/Rendering/Qt/vtkQtStringToImage.cxx -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - #include - #include - #include -diff --git a/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx b/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx -index 2b0d443537..e18525a470 100644 ---- a/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx -+++ b/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx -@@ -186,7 +186,7 @@ PyTypeObject PyVTKMethodDescriptor_Type = { - sizeof(PyMethodDescrObject), // tp_basicsize - 0, // tp_itemsize - PyVTKMethodDescriptor_Delete, // tp_dealloc -- nullptr, // tp_print -+ 0, // tp_print - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare -diff --git a/Wrapping/PythonCore/PyVTKNamespace.cxx b/Wrapping/PythonCore/PyVTKNamespace.cxx -index 71ee2a3516..1c5f85c3d4 100644 ---- a/Wrapping/PythonCore/PyVTKNamespace.cxx -+++ b/Wrapping/PythonCore/PyVTKNamespace.cxx -@@ -49,7 +49,7 @@ PyTypeObject PyVTKNamespace_Type = { - 0, // tp_basicsize - 0, // tp_itemsize - PyVTKNamespace_Delete, // tp_dealloc -- nullptr, // tp_print -+ 0, // tp_print - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare -diff --git a/Wrapping/PythonCore/PyVTKReference.cxx b/Wrapping/PythonCore/PyVTKReference.cxx -index 943ac71080..6f3e0130a8 100644 ---- a/Wrapping/PythonCore/PyVTKReference.cxx -+++ b/Wrapping/PythonCore/PyVTKReference.cxx -@@ -1010,7 +1010,7 @@ PyTypeObject PyVTKReference_Type = { - sizeof(PyVTKReference), // tp_basicsize - 0, // tp_itemsize - PyVTKReference_Delete, // tp_dealloc -- nullptr, // tp_print -+ 0, // tp_print - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare -@@ -1067,7 +1067,7 @@ PyTypeObject PyVTKNumberReference_Type = { - sizeof(PyVTKReference), // tp_basicsize - 0, // tp_itemsize - PyVTKReference_Delete, // tp_dealloc -- nullptr, // tp_print -+ 0, // tp_print - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare -@@ -1124,7 +1124,7 @@ PyTypeObject PyVTKStringReference_Type = { - sizeof(PyVTKReference), // tp_basicsize - 0, // tp_itemsize - PyVTKReference_Delete, // tp_dealloc -- nullptr, // tp_print -+ 0, // tp_print - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare -@@ -1181,7 +1181,7 @@ PyTypeObject PyVTKTupleReference_Type = { - sizeof(PyVTKReference), // tp_basicsize - 0, // tp_itemsize - PyVTKReference_Delete, // tp_dealloc -- nullptr, // tp_print -+ 0, // tp_print - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare -diff --git a/Wrapping/PythonCore/PyVTKTemplate.cxx b/Wrapping/PythonCore/PyVTKTemplate.cxx -index be200985b3..ebc236ad5f 100644 ---- a/Wrapping/PythonCore/PyVTKTemplate.cxx -+++ b/Wrapping/PythonCore/PyVTKTemplate.cxx -@@ -268,7 +268,7 @@ PyTypeObject PyVTKTemplate_Type = { - 0, // tp_basicsize - 0, // tp_itemsize - nullptr, // tp_dealloc -- nullptr, // tp_print -+ 0, // tp_print - nullptr, // tp_getattr - nullptr, // tp_setattr - nullptr, // tp_compare -diff --git a/Wrapping/Tools/vtkWrapPythonClass.c b/Wrapping/Tools/vtkWrapPythonClass.c -index 989101b2ee..9a8b465acd 100644 ---- a/Wrapping/Tools/vtkWrapPythonClass.c -+++ b/Wrapping/Tools/vtkWrapPythonClass.c -@@ -527,7 +527,7 @@ void vtkWrapPython_GenerateObjectType( - " sizeof(PyVTKObject), // tp_basicsize\n" - " 0, // tp_itemsize\n" - " PyVTKObject_Delete, // tp_dealloc\n" -- " nullptr, // tp_print\n" -+ " 0, // tp_print\n" - " nullptr, // tp_getattr\n" - " nullptr, // tp_setattr\n" - " nullptr, // tp_compare\n" -diff --git a/Wrapping/Tools/vtkWrapPythonEnum.c b/Wrapping/Tools/vtkWrapPythonEnum.c -index b933702242..57c077490a 100644 ---- a/Wrapping/Tools/vtkWrapPythonEnum.c -+++ b/Wrapping/Tools/vtkWrapPythonEnum.c -@@ -145,7 +145,7 @@ void vtkWrapPython_GenerateEnumType( - " sizeof(PyIntObject), // tp_basicsize\n" - " 0, // tp_itemsize\n" - " nullptr, // tp_dealloc\n" -- " nullptr, // tp_print\n" -+ " 0, // tp_print\n" - " nullptr, // tp_getattr\n" - " nullptr, // tp_setattr\n" - " nullptr, // tp_compare\n" -diff --git a/Wrapping/Tools/vtkWrapPythonType.c b/Wrapping/Tools/vtkWrapPythonType.c -index 744cb1b9d3..f6361bcb26 100644 ---- a/Wrapping/Tools/vtkWrapPythonType.c -+++ b/Wrapping/Tools/vtkWrapPythonType.c -@@ -709,7 +709,7 @@ void vtkWrapPython_GenerateSpecialType( - " sizeof(PyVTKSpecialObject), // tp_basicsize\n" - " 0, // tp_itemsize\n" - " Py%s_Delete, // tp_dealloc\n" -- " nullptr, // tp_print\n" -+ " 0, // tp_print\n" - " nullptr, // tp_getattr\n" - " nullptr, // tp_setattr\n" - " nullptr, // tp_compare\n" diff --git a/superbuild/projects_modules/ITK.cmake b/superbuild/projects_modules/ITK.cmake index 9cf28d26e0..5641d41491 100644 --- a/superbuild/projects_modules/ITK.cmake +++ b/superbuild/projects_modules/ITK.cmake @@ -40,7 +40,7 @@ if (NOT USE_SYSTEM_${ep}) set(git_url ${GITHUB_PREFIX}InsightSoftwareConsortium/ITK.git) -set(git_tag v5.2.1) +set(git_tag v5.4rc04) ## ############################################################################# diff --git a/superbuild/projects_modules/LogDemons.cmake b/superbuild/projects_modules/LogDemons.cmake index e65ecc9301..04648431b1 100644 --- a/superbuild/projects_modules/LogDemons.cmake +++ b/superbuild/projects_modules/LogDemons.cmake @@ -40,7 +40,7 @@ if (NOT USE_SYSTEM_${ep}) ## ############################################################################# set(git_url ${GITHUB_PREFIX}Inria-Asclepios/LCC-LogDemons.git) -set(git_tag ITK5.1.1) +set(git_tag ITK5.3rc04) ## ############################################################################# ## Add specific cmake arguments for configuration step of the project diff --git a/superbuild/projects_modules/RPI.cmake b/superbuild/projects_modules/RPI.cmake index 25833c8221..691879091a 100644 --- a/superbuild/projects_modules/RPI.cmake +++ b/superbuild/projects_modules/RPI.cmake @@ -40,8 +40,8 @@ if (NOT USE_SYSTEM_${ep}) ## Set up versioning control ## ############################################################################# -set(git_url ${GITHUB_PREFIX}medInria/RPI.git) -set(git_tag ITK5.1.1) +set(git_url ${GITHUB_PREFIX}Inria-Asclepios/RPI.git) +set(git_tag ITK5.4rc04) ## ############################################################################# ## Add specific cmake arguments for configuration step of the project diff --git a/superbuild/projects_modules/TTK.cmake b/superbuild/projects_modules/TTK.cmake index 9b46d4aaae..a001972182 100644 --- a/superbuild/projects_modules/TTK.cmake +++ b/superbuild/projects_modules/TTK.cmake @@ -41,7 +41,7 @@ if (NOT USE_SYSTEM_${ep}) ## ############################################################################# set(git_url ${GITHUB_PREFIX}medInria/TTK.git) -set(git_tag ITK5.2.1) +set(git_tag ITK5.4rc04+VTK9) ## ############################################################################# ## Add specific cmake arguments for configuration step of the project diff --git a/superbuild/projects_modules/VTK.cmake b/superbuild/projects_modules/VTK.cmake index 72d34cd3cd..6653049ca0 100644 --- a/superbuild/projects_modules/VTK.cmake +++ b/superbuild/projects_modules/VTK.cmake @@ -43,7 +43,7 @@ if (NOT USE_SYSTEM_${ep}) ## ############################################################################# set(git_url ${GITHUB_PREFIX}Kitware/VTK.git) -set(git_tag v8.1.2) +set(git_tag v9.2.6) ## ############################################################################# @@ -72,15 +72,14 @@ set(cmake_args -DCMAKE_SHARED_LINKER_FLAGS=${${ep}_shared_linker_flags} -DCMAKE_INSTALL_PREFIX= -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS_${ep}} - -DBUILD_TESTING=OFF - -DBUILD_DOCUMENTATION=OFF - -DBUILD_EXAMPLES=OFF + -DVTK_BUILD_TESTING=OFF + -DVTK_BUILD_DOCUMENTATION=OFF + -DVTK_BUILD_EXAMPLES=OFF -DVTK_RENDERING_BACKEND=OpenGL2 - -DVTK_Group_Qt=ON - -DModule_vtkGUISupportQtOpenGL=ON - -DModule_vtkRenderingOSPRay:BOOL=${USE_OSPRay} -DVTK_QT_VERSION=5 - -DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON # OGV Export + -DVTK_MODULE_ENABLE_VTK_GUISupportQt=YES + -DVTK_MODULE_ENABLE_VTK_RenderingQt=YES + -DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON ) set(cmake_cache_args @@ -89,6 +88,7 @@ set(cmake_cache_args if(USE_OSPRay) list(APPEND cmake_args + -DVTK_MODULE_ENABLE_VTK_RenderingOSPRay=YES -Dospray_DIR=${ospray_DIR} -DOSPRAY_INSTALL_DIR=${OSPRAY_INSTALL_DIR} ) @@ -98,7 +98,7 @@ endif() if(${USE_FFmpeg}) list(APPEND cmake_args # FFMPEG - -DModule_vtkIOFFMPEG:BOOL=ON + -DVTK_MODULE_ENABLE_VTK_IOFFMPEG=YES -DFFMPEG_ROOT:STRING=${EP_PATH_BUILD}/ffmpeg -DFFMPEG_INCLUDE_DIR:STRING=${EP_PATH_BUILD}/ffmpeg/include/ @@ -134,19 +134,13 @@ if(USE_Python) -DVTK_WRAP_PYTHON:BOOL=ON -DModule_vtkPython:BOOL=ON -DModule_vtkWrappingTools:BOOL=ON - -DVTK_PYTHON_VERSION:STRING=${python_version} + -DVTK_PYTHON_VERSION:STRING=${PYTHON_VERSION_MAJOR} -DPYTHON_EXECUTABLE:PATH=${python_executable} -DPYTHON_INCLUDE_DIR:PATH=${python_include} -DPYTHON_LIBRARY:PATH=${python_library} ) endif() -## ############################################################################# -## Check if patch has to be applied -## ############################################################################# - -ep_GeneratePatchCommand(${ep} ${ep}_PATCH_COMMAND VTK.patch) - ## ############################################################################# ## Add external-project ## ############################################################################# @@ -170,7 +164,6 @@ ExternalProject_Add(${ep} DEPENDS ${${ep}_dependencies} INSTALL_COMMAND "" ) - ## ############################################################################# ## Set variable to provide infos about the project ## ############################################################################# diff --git a/superbuild/projects_modules/medInria.cmake b/superbuild/projects_modules/medInria.cmake index 9c2c1d64ad..55f430d597 100644 --- a/superbuild/projects_modules/medInria.cmake +++ b/superbuild/projects_modules/medInria.cmake @@ -141,10 +141,9 @@ ExternalProject_Add(${ep} ## ############################################################################# if (WIN32) - file(REAL_PATH ${TTK_DIR}/../../../ _TTK_DIR) file(TO_NATIVE_PATH ${ITK_ROOT} ITK_BIN_BASE) file(TO_NATIVE_PATH ${VTK_ROOT} VTK_BIN_BASE) - file(TO_NATIVE_PATH ${_TTK_DIR} TTK_BIN_BASE) + file(TO_NATIVE_PATH ${TTK_ROOT} TTK_BIN_BASE) file(TO_NATIVE_PATH ${dtk_ROOT} DTK_BIN_BASE) file(TO_NATIVE_PATH ${QtDCM_ROOT} DCM_BIN_BASE) file(TO_NATIVE_PATH ${_qt5Core_install_prefix} QT5_BIN_BASE) diff --git a/superbuild/projects_modules/music-plugins.cmake b/superbuild/projects_modules/music-plugins.cmake index ec7285ee09..ba47525e8e 100644 --- a/superbuild/projects_modules/music-plugins.cmake +++ b/superbuild/projects_modules/music-plugins.cmake @@ -40,8 +40,8 @@ function(music_plugins_project) if (NOT USE_SYSTEM_${external_project}) - set(git_url ${GITHUB_PREFIX}Inria-Asclepios/music.git) - set(git_tag master) + set(git_url ${GITHUB_PREFIX}mathildemerle/music.git) + set(git_tag vtk9Package) set(cmake_args ${ep_common_cache_args} From 6363bf93ef14ad6dc4407a5649287de95ae2ee9b Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Fri, 22 Nov 2024 11:36:55 +0100 Subject: [PATCH 06/20] Revert "[VTK9.2.6] switch to more recent VTK and ITK5.4rc04 (#859)" (#869) This reverts commit 63fdbf366e87c1760145de6f76747d97452ff79a. --- packaging/windows/WindowsPackaging.cmake | 2 +- packaging/windows/medInria-dev.bat.in | 8 +- packaging/windows/medInria.bat.in | 8 +- .../medPluginGenerator/tests/CMakeLists.txt | 6 +- .../tests/medPluginGeneratorTest.cpp | 6 +- src/cmake/module/set_exe_install_rules.cmake | 2 +- .../medStartupSettingsWidget.cpp | 12 ++ src/layers/legacy/medImageIO/CMakeLists.txt | 2 +- src/layers/legacy/medLog/CMakeLists.txt | 6 +- src/layers/legacy/medUtilities/CMakeLists.txt | 4 +- .../legacy/medVtkDataMeshBase/CMakeLists.txt | 8 +- .../medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx | 18 +- .../medVtkDataMeshBase/vtkMetaVolumeMesh.cxx | 22 +- src/layers/legacy/medVtkInria/CMakeLists.txt | 29 ++- .../vtkImageView/vtkAxes2DWidget.cxx | 2 +- .../vtkImageView/vtkImageView3D.cxx | 3 +- .../vtkTessellatedSphereSource.cxx | 17 +- .../toolboxes/medDiffusionSelectorToolBox.cpp | 2 +- .../iterativeClosestPoint/CMakeLists.txt | 7 +- .../limit/vtkLimitVectorsToVOI.cxx | 8 - .../legacy/itkDataImage/tests/CMakeLists.txt | 4 +- .../legacy/itkDataSHImage/CMakeLists.txt | 4 +- .../management/vtkSphericalHarmonicSource.h | 2 +- .../legacy/itkDataTensorImage/CMakeLists.txt | 7 +- .../legacy/manualRegistration/CMakeLists.txt | 4 +- .../medCreateMeshFromMask/CMakeLists.txt | 4 +- .../legacy/medExportVideo/CMakeLists.txt | 15 +- .../legacy/medRemeshing/CMakeLists.txt | 8 +- .../legacy/medVtkFibersData/CMakeLists.txt | 6 +- .../medVtkFibersDataInteractor.cpp | 4 +- .../limit/vtkLimitFibersToROI.cxx | 2 +- .../limit/vtkLimitFibersToVOI.cxx | 2 +- .../manager/vtkFiberPickerCallback.cpp | 12 +- .../readers/vtkXMLFiberDataSetReader.cxx | 1 - src/plugins/legacy/medVtkView/CMakeLists.txt | 7 +- src/plugins/legacy/medVtkView/medVtkView.cpp | 8 +- .../legacy/meshManipulation/CMakeLists.txt | 5 +- src/plugins/legacy/meshMapping/CMakeLists.txt | 4 +- .../legacy/meshMapping/meshMapping.cpp | 104 +++++++--- src/plugins/legacy/meshMapping/meshMapping.h | 4 + src/plugins/legacy/polygonRoi/CMakeLists.txt | 7 +- src/plugins/legacy/reformat/CMakeLists.txt | 9 +- .../legacy/reformat/medResliceViewer.cpp | 143 +++++++------ .../legacy/reformat/medResliceViewer.h | 10 +- .../variationalSegmentation/CMakeLists.txt | 4 +- src/plugins/legacy/voiCutter/CMakeLists.txt | 6 +- src/plugins/legacy/vtkDataMesh/CMakeLists.txt | 9 +- .../ttkTensorScalarMapsProcess/CMakeLists.txt | 7 +- .../CMakeLists.txt | 8 +- superbuild/patches/VTK.patch | 193 ++++++++++++++++++ superbuild/projects_modules/ITK.cmake | 2 +- superbuild/projects_modules/LogDemons.cmake | 2 +- superbuild/projects_modules/RPI.cmake | 4 +- superbuild/projects_modules/TTK.cmake | 2 +- superbuild/projects_modules/VTK.cmake | 27 ++- superbuild/projects_modules/medInria.cmake | 3 +- .../projects_modules/music-plugins.cmake | 4 +- 57 files changed, 550 insertions(+), 269 deletions(-) create mode 100644 superbuild/patches/VTK.patch diff --git a/packaging/windows/WindowsPackaging.cmake b/packaging/windows/WindowsPackaging.cmake index 4548e07d63..9989550ca1 100644 --- a/packaging/windows/WindowsPackaging.cmake +++ b/packaging/windows/WindowsPackaging.cmake @@ -121,7 +121,7 @@ file(GLOB_RECURSE itk_files LIST_DIRECTORIES true \"${ITK_ROOT}/bin/*.dll\") file(GLOB_RECURSE vtk_files LIST_DIRECTORIES true \"${VTK_ROOT}/bin/*.dll\") file(GLOB_RECURSE dtk_files LIST_DIRECTORIES true \"${dtk_ROOT}/bin/*.dll\") file(GLOB_RECURSE dcm_files LIST_DIRECTORIES true \"${QtDCM_ROOT}/bin/*.dll\") -file(GLOB_RECURSE ttk_files LIST_DIRECTORIES true \"${TTK_ROOT}/bin/*.dll\") +file(GLOB_RECURSE ttk_files LIST_DIRECTORIES true \"${TTK_DIR}/bin/*.dll\") file(GLOB_RECURSE qt5_files LIST_DIRECTORIES true \"${QT_BINARY_DIR}/*.dll\") file(GLOB_RECURSE zlib_files LIST_DIRECTORIES true \"${ZLIB_ROOT}/*.dll\") list(APPEND files \${itk_files}) diff --git a/packaging/windows/medInria-dev.bat.in b/packaging/windows/medInria-dev.bat.in index 969a1f06ce..27c027980f 100644 --- a/packaging/windows/medInria-dev.bat.in +++ b/packaging/windows/medInria-dev.bat.in @@ -3,9 +3,9 @@ call "%@VS_TYPE@%\..\..\VC\vcvarsall.bat" @WIN_TYPE@ REM This .bat sets the environment variables medInria_PLUGINS_DIR and PATH and launches Visual Studio REM Usage : medInria-dev.bat @echo off -set PATH=%PATH%;@dtk_ROOT@/bin/%1;@ITK_ROOT@/bin/%1;@TTK_ROOT@/bin/%1;@VTK_ROOT@/bin/%1;@QtDCM_ROOT@/bin/%1;@medInria_BINARY_DIR@/bin/%1;@QT_BINARY_DIR@ -set MEDINRIA_PLUGINS_DIR=@medInria_BINARY_DIR@/bin/plugins/%1;@DEV_PLUGINS_DIRS@ -set MEDINRIA_PLUGINS_DIR_LEGACY=@medInria_BINARY_DIR@/bin/plugins_legacy/%1:@DEV_PLUGINS_LEGACY_DIRS@ +set PATH=%PATH%;@dtk_DIR@/bin/%1;@ITK_DIR@/bin/%1;@TTK_DIR@/bin/%1;@VTK_DIR@/bin/%1;@QtDCM_DIR@/bin/%1;@medInria_DIR@/bin/%1;@QT_BINARY_DIR@ +set MEDINRIA_PLUGINS_DIR=@medInria_DIR@/bin/plugins/%1;@DEV_PLUGINS_DIRS@ +set MEDINRIA_PLUGINS_DIR_LEGACY=@medInria_DIR@/bin/plugins_legacy/%1:@DEV_PLUGINS_LEGACY_DIRS@ -start devenv.exe @medInria_BINARY_DIR@/ALL_BUILD.vcxproj +start devenv.exe @medInria_DIR@/ALL_BUILD.vcxproj exit diff --git a/packaging/windows/medInria.bat.in b/packaging/windows/medInria.bat.in index d3c41313dd..c1b5cce94a 100755 --- a/packaging/windows/medInria.bat.in +++ b/packaging/windows/medInria.bat.in @@ -1,11 +1,11 @@ REM This .bat sets the environment variables medInria_PLUGINS_DIR and PATH and launches medInria REM Usage : medInria.bat @echo off -set PATH=%PATH%;@dtk_ROOT@/bin/%1;@ITK_ROOT@/bin/%1;@TTK_ROOT@/bin/%1;@VTK_ROOT@/bin/%1;@QtDCM_ROOT@/bin/%1;@medInria_BINARY_DIR@/bin/%1;@QT_BINARY_DIR@ -set MEDINRIA_PLUGINS_DIR=@medInria_BINARY_DIR@/plugins/%1:@DEV_PLUGINS_DIRS@ -set MEDINRIA_PLUGINS_DIR_LEGACY=@medInria_BINARY_DIR@/plugins_legacy/%1:@DEV_PLUGINS_LEGACY_DIRS@ +set PATH=%PATH%;@dtk_DIR@/bin/%1;@ITK_DIR@/bin/%1;@TTK_DIR@/bin/%1;@VTK_DIR@/bin/%1;@QtDCM_DIR@/bin/%1;@medInria_DIR@/bin/%1;@QT_BINARY_DIR@ +set MEDINRIA_PLUGINS_DIR=@medInria_DIR@/plugins/%1:@DEV_PLUGINS_DIRS@ +set MEDINRIA_PLUGINS_DIR_LEGACY=@medInria_DIR@/plugins_legacy/%1:@DEV_PLUGINS_LEGACY_DIRS@ -set BIN_PATH=@medInria_BINARY_DIR@/bin/%1 +set BIN_PATH=@medInria_DIR@/bin/%1 shift set args=%1 diff --git a/src/app/medPluginGenerator/tests/CMakeLists.txt b/src/app/medPluginGenerator/tests/CMakeLists.txt index def2f76786..f5e401ac3f 100644 --- a/src/app/medPluginGenerator/tests/CMakeLists.txt +++ b/src/app/medPluginGenerator/tests/CMakeLists.txt @@ -40,9 +40,9 @@ include_directories(${${PROJECT_NAME}_INCLUDE_DIRS} ## Add definitions ## ############################################################################# -add_definitions("-DCMAKE_DTK_DIR=\"${dtk_ROOT}\"" - "-DCMAKE_ITK_DIR=\"${ITK_ROOT}\"" - "-DCMAKE_RPI_DIR=\"${RPI_ROOT}\"" +add_definitions("-DCMAKE_DTK_DIR=\"${dtk_DIR}\"" + "-DCMAKE_ITK_DIR=\"${ITK_DIR}\"" + "-DCMAKE_RPI_DIR=\"${RPI_DIR}\"" "-DCMAKE_BINARY_DIR=\"${CMAKE_BINARY_DIR}\"" ) diff --git a/src/app/medPluginGenerator/tests/medPluginGeneratorTest.cpp b/src/app/medPluginGenerator/tests/medPluginGeneratorTest.cpp index 57c23bc196..a23005220c 100644 --- a/src/app/medPluginGenerator/tests/medPluginGeneratorTest.cpp +++ b/src/app/medPluginGenerator/tests/medPluginGeneratorTest.cpp @@ -144,9 +144,9 @@ void medPluginGeneratorTest::testCompile() args.clear(); args << QString("-DMEDINRIA_DIR:PATH=%1").arg(CMAKE_BINARY_DIR) - << QString("-Ddtk_ROOT:PATH=%1").arg(CMAKE_DTK_DIR) - << QString("-DITK_ROOT:PATH=%1").arg(CMAKE_ITK_DIR) - << QString("-DRPI_ROOT:PATH=%1").arg(CMAKE_RPI_DIR) + << QString("-Ddtk_DIR:PATH=%1").arg(CMAKE_DTK_DIR) + << QString("-DITK_DIR:PATH=%1").arg(CMAKE_ITK_DIR) + << QString("-DRPI_DIR:PATH=%1").arg(CMAKE_RPI_DIR) << _tmpPath.absoluteFilePath(nameFirstLower); pGen.setWorkingDirectory(buildDir.absolutePath()); pGen.start("cmake", args); diff --git a/src/cmake/module/set_exe_install_rules.cmake b/src/cmake/module/set_exe_install_rules.cmake index 2437782dad..556255e7a1 100644 --- a/src/cmake/module/set_exe_install_rules.cmake +++ b/src/cmake/module/set_exe_install_rules.cmake @@ -62,7 +62,7 @@ if (APPLE) \${QT_BINARY_DIR}/macdeployqt \${CMAKE_INSTALL_PREFIX}/bin/${target}.app ) execute_process(COMMAND - \${dtk_ROOT}/bin/dtkDeploy \${CMAKE_INSTALL_PREFIX}/bin/${target}.app -inject-dir=\${CMAKE_CURRENT_BINARY_DIR}/plugins + \${dtk_DIR}/bin/dtkDeploy \${CMAKE_INSTALL_PREFIX}/bin/${target}.app -inject-dir=\${CMAKE_CURRENT_BINARY_DIR}/plugins ) ") endif() diff --git a/src/layers/legacy/medCoreLegacy/gui/settingsWidgets/medStartupSettingsWidget.cpp b/src/layers/legacy/medCoreLegacy/gui/settingsWidgets/medStartupSettingsWidget.cpp index 0b6673e74d..7fde169440 100644 --- a/src/layers/legacy/medCoreLegacy/gui/settingsWidgets/medStartupSettingsWidget.cpp +++ b/src/layers/legacy/medCoreLegacy/gui/settingsWidgets/medStartupSettingsWidget.cpp @@ -24,12 +24,24 @@ class medStartupSettingsWidgetPrivate { public: + QWidget *parent; QCheckBox *startInFullScreen; QComboBox *defaultStartingArea; QComboBox* theme; QComboBox *defaultSegmentationSpeciality; + + medStartupSettingsWidgetPrivate(); + ~medStartupSettingsWidgetPrivate(); }; +medStartupSettingsWidgetPrivate::medStartupSettingsWidgetPrivate() +{ +} + +medStartupSettingsWidgetPrivate::~medStartupSettingsWidgetPrivate() +{ +} + medStartupSettingsWidget::medStartupSettingsWidget(QWidget *parent) : medSettingsWidget(parent), d(new medStartupSettingsWidgetPrivate()) { setTabName(tr("Startup")); diff --git a/src/layers/legacy/medImageIO/CMakeLists.txt b/src/layers/legacy/medImageIO/CMakeLists.txt index 72cb5ebf9d..7b65c22aad 100644 --- a/src/layers/legacy/medImageIO/CMakeLists.txt +++ b/src/layers/legacy/medImageIO/CMakeLists.txt @@ -93,7 +93,7 @@ target_link_libraries(${TARGET_NAME} ITKIOMRC ITKIOTIFF ITKVTK - VTK::IOImage + vtkIOImage ${ITKIOPhilipsREC_LIBRARIES} ${DCMTK_LIBRARIES} ) diff --git a/src/layers/legacy/medLog/CMakeLists.txt b/src/layers/legacy/medLog/CMakeLists.txt index 0c2535460f..b5951457b5 100644 --- a/src/layers/legacy/medLog/CMakeLists.txt +++ b/src/layers/legacy/medLog/CMakeLists.txt @@ -28,9 +28,9 @@ find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) # find vtk -find_package(VTK REQUIRED COMPONENTS CommonCore) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore) +include(${VTK_USE_FILE}) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES VTK::CommonCore) ## ############################################################################# ## List Sources @@ -73,7 +73,7 @@ target_link_libraries(${TARGET_NAME} dtkCoreSupport dtkLog ITKCommon - VTK::CommonCore + vtkCommonCore ) ## ############################################################################# diff --git a/src/layers/legacy/medUtilities/CMakeLists.txt b/src/layers/legacy/medUtilities/CMakeLists.txt index 80ce290399..61d4ee6bb7 100644 --- a/src/layers/legacy/medUtilities/CMakeLists.txt +++ b/src/layers/legacy/medUtilities/CMakeLists.txt @@ -22,7 +22,8 @@ set(TARGET_NAME medUtilities) find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) -find_package(VTK REQUIRED COMPONENTS InteractionWidgets) +find_package(VTK REQUIRED COMPONENTS vtkInteractionWidgets ) +include(${VTK_USE_FILE}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKGDCM ITKIOGDCM ITKThresholding) include(${ITK_USE_FILE}) @@ -70,7 +71,6 @@ target_link_libraries(${TARGET_NAME} medCoreLegacy medVtkInria medVtkDataMeshBase - VTK::InteractionWidgets ) diff --git a/src/layers/legacy/medVtkDataMeshBase/CMakeLists.txt b/src/layers/legacy/medVtkDataMeshBase/CMakeLists.txt index 022d91f09a..76f37ded7d 100644 --- a/src/layers/legacy/medVtkDataMeshBase/CMakeLists.txt +++ b/src/layers/legacy/medVtkDataMeshBase/CMakeLists.txt @@ -22,8 +22,9 @@ set(TARGET_NAME medVtkDataMeshBase) find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) -find_package(VTK REQUIRED COMPONENTS CommonCore CommonDataModel RenderingCore RenderingVolumeOpenGL2 - InteractionStyle InteractionWidgets IOParallelXML IOImage IOGeometry IOExport RenderingContext2D IOInfovis) + +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonDataModel vtkRenderingCore vtkRenderingVolumeOpenGL2 vtkInteractionStyle vtkInteractionWidgets vtkIOParallelXML vtkIOImage vtkIOGeometry vtkIOExport vtkRenderingContext2D vtkIOInfovis) +include(${VTK_USE_FILE}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) @@ -62,13 +63,12 @@ target_include_directories(${TARGET_NAME} ## ############################################################################# target_link_libraries(${TARGET_NAME} - ${VTK_LIBRARIES} + vtkIOInfovis medCore medLog medVtkInria ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## install diff --git a/src/layers/legacy/medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx b/src/layers/legacy/medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx index 855e51109d..a41382ca40 100644 --- a/src/layers/legacy/medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx +++ b/src/layers/legacy/medVtkDataMeshBase/vtkMetaSurfaceMesh.cxx @@ -109,7 +109,7 @@ void vtkMetaSurfaceMesh::ReadVtkFile (const char* filename) else { vtkErrorMacro(<< "Can not read file with version > " << vtkLegacyReaderMajorVersion - << "." << vtkLegacyReaderMinorVersion << ": " << filename << endl); + << "." << vtkLegacyReaderMinorVersion << ": " << filename << endl) throw vtkErrorCode::FileFormatError; } } @@ -193,7 +193,7 @@ void vtkMetaSurfaceMesh::Read (const char* filename) this->ReadOBJFile (filename); break; default : - vtkErrorMacro(<<"unknown dataset type : "<DataSet) { - vtkErrorMacro(<<"No DataSet to write"<DataSet); if (!c_mesh) { - vtkErrorMacro(<<"DataSet is not a polydata object"<DataSet) { - vtkErrorMacro(<<"No DataSet to write"<DataSet); if (!c_mesh) { - vtkErrorMacro(<<"DataSet is not a polydata object"< " << vtkLegacyReaderMajorVersion - << "." << vtkLegacyReaderMinorVersion << ": " << filename << endl); + << "." << vtkLegacyReaderMinorVersion << ": " << filename << endl) throw vtkErrorCode::FileFormatError; } } @@ -158,7 +158,7 @@ void vtkMetaVolumeMesh::Read (const char* filename) this->ReadGMeshFile (filename); break; default : - vtkErrorMacro(<<"unknown dataset type : "<DataSet) { - vtkErrorMacro(<<"No DataSet to write"<DataSet); if (!c_mesh) { - vtkErrorMacro(<<"DataSet is not a polydata object"<DataSet) { - vtkErrorMacro(<<"No DataSet to write"<DataSet); if (!c_mesh) { - vtkErrorMacro(<<"DataSet is not a polydata object"<Delete(); cellarray->Delete(); outputmesh->Delete(); - vtkErrorMacro("No point in file\n"); + vtkErrorMacro("No point in file\n") throw vtkErrorCode::CannotOpenFileError; } file >> str; @@ -639,7 +639,7 @@ void vtkMetaVolumeMesh::ReadGMeshFile (const char* filename) pointarray->Delete(); cellarray->Delete(); outputmesh->Delete(); - vtkErrorMacro("No tetrahedron in file\n"); + vtkErrorMacro("No tetrahedron in file\n") throw vtkErrorCode::CannotOpenFileError; } file >> str; diff --git a/src/layers/legacy/medVtkInria/CMakeLists.txt b/src/layers/legacy/medVtkInria/CMakeLists.txt index 66fb896f54..f8041aca6d 100644 --- a/src/layers/legacy/medVtkInria/CMakeLists.txt +++ b/src/layers/legacy/medVtkInria/CMakeLists.txt @@ -19,8 +19,8 @@ set(TARGET_NAME medVtkInria) ## Find required ## ############################################################################# -find_package(VTK REQUIRED COMPONENTS RenderingVolumeOpenGL2 InteractionWidgets RenderingAnnotation - InteractionStyle ImagingStatistics IOLegacy RenderingVolume IOImage FiltersGeometry ImagingColor) +find_package(VTK REQUIRED COMPONENTS vtkRenderingVolumeOpenGL2 vtkInteractionWidgets vtkRenderingAnnotation vtkInteractionStyle vtkImagingStatistics vtkIOLegacy ) +include(${VTK_USE_FILE}) find_package(OpenGL REQUIRED) @@ -75,11 +75,32 @@ target_link_libraries(${TARGET_NAME} Qt5::Core Qt5::Widgets medCoreLegacy + vtkCommonCore + vtkCommonSystem + vtkImagingColor + vtkImagingGeneral + vtkImagingHybrid + vtkIOCore + vtkIOExportOpenGL2 + vtkIOGeometry + vtkIOImage + vtkIOLegacy + vtkIOXML + vtkRenderingAnnotation + vtkRenderingCore + vtkRenderingOpenGL2 + vtkRenderingVolumeOpenGL2 + vtkRenderingContextOpenGL2 ${VTK_OSPRAY_RENDERING_LIBRARY} - ${VTK_LIBRARIES} + vtkInteractionWidgets + vtkInteractionStyle + vtkFiltersExtraction + vtkFiltersModeling + vtkImagingStencil + vtkFiltersGeometry + vtksys ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## install diff --git a/src/layers/legacy/medVtkInria/vtkImageView/vtkAxes2DWidget.cxx b/src/layers/legacy/medVtkInria/vtkImageView/vtkAxes2DWidget.cxx index 86248d9185..be0b3d97b3 100644 --- a/src/layers/legacy/medVtkInria/vtkImageView/vtkAxes2DWidget.cxx +++ b/src/layers/legacy/medVtkInria/vtkImageView/vtkAxes2DWidget.cxx @@ -36,7 +36,7 @@ #include #include #include -#include + vtkStandardNewMacro(vtkAxes2DWidget); diff --git a/src/layers/legacy/medVtkInria/vtkImageView/vtkImageView3D.cxx b/src/layers/legacy/medVtkInria/vtkImageView/vtkImageView3D.cxx index bf69fd37a3..aa557fe7e6 100644 --- a/src/layers/legacy/medVtkInria/vtkImageView/vtkImageView3D.cxx +++ b/src/layers/legacy/medVtkInria/vtkImageView/vtkImageView3D.cxx @@ -944,8 +944,7 @@ vtkSmartPointer vtkImageView3D::DataSetToActor(vtkPointSet* arg, vtkPr idFilter->PointIdsOn(); idFilter->CellIdsOn(); idFilter->FieldDataOn(); - idFilter->SetCellIdsArrayName("vtkOriginalIds"); - idFilter->SetPointIdsArrayName("vtkOriginalIds"); + idFilter->SetIdsArrayName("vtkOriginalIds"); idFilter->SetInputData(arg); geometryextractor->SetInputConnection(idFilter->GetOutputPort()); diff --git a/src/layers/legacy/medVtkInria/vtkVisuManagement/vtkTessellatedSphereSource.cxx b/src/layers/legacy/medVtkInria/vtkVisuManagement/vtkTessellatedSphereSource.cxx index b18cc40a7e..be92a85f1f 100644 --- a/src/layers/legacy/medVtkInria/vtkVisuManagement/vtkTessellatedSphereSource.cxx +++ b/src/layers/legacy/medVtkInria/vtkVisuManagement/vtkTessellatedSphereSource.cxx @@ -185,7 +185,7 @@ void TesselateTriangles(vtkPoints* oldVertices,vtkCellArray* oldTriangles, MidPointIds ids; vtkIdType numCellPts = 0; - vtkIdType const *pts = nullptr; + vtkIdType* pts; oldTriangles->InitTraversal(); for (int current2P=oldPoints;oldTriangles->GetNextCell(numCellPts,pts);) { @@ -220,20 +220,17 @@ void TesselateTriangles(vtkPoints* oldVertices,vtkCellArray* oldTriangles, vertices->SetPoint(current2P++,midPoint); } - // Add the triangles - vtkIdType tmpPts[3]; - std::copy(pts, pts + 3, tmpPts); + // Add the triangles. const vtkIdType c3 = 3; triangles->InsertNextCell(c3,triPointsIds); std::swap(triPointsIds[0],triPointsIds[1]); - std::swap(tmpPts[0], tmpPts[1]); + std::swap(pts[0],pts[1]); - for (int j=0;j<3;++j) - { - std::swap(triPointsIds[j], tmpPts[j]); - triangles->InsertNextCell(c3, triPointsIds); - std::swap(triPointsIds[j], tmpPts[j]); + for (int j=0;j<3;++j) { + std::swap(triPointsIds[j],pts[j]); + triangles->InsertNextCell(c3,triPointsIds); + std::swap(triPointsIds[j],pts[j]); } } } diff --git a/src/layers/medWidgets/toolboxes/medDiffusionSelectorToolBox.cpp b/src/layers/medWidgets/toolboxes/medDiffusionSelectorToolBox.cpp index 240d8b8977..d9c07d235e 100644 --- a/src/layers/medWidgets/toolboxes/medDiffusionSelectorToolBox.cpp +++ b/src/layers/medWidgets/toolboxes/medDiffusionSelectorToolBox.cpp @@ -115,7 +115,7 @@ medDiffusionSelectorToolBox::medDiffusionSelectorToolBox(QWidget *parent, Select case Tractography: default: - labelTitle = tr("Tractography"); + labelTitle = tr("Tractography algorithm"); for(QString pluginKey : medCore::tractography::pluginFactory().keys()) { medAbstractProcess *process = medCore::tractography::pluginFactory().create(pluginKey); diff --git a/src/plugins/legacy/iterativeClosestPoint/CMakeLists.txt b/src/plugins/legacy/iterativeClosestPoint/CMakeLists.txt index 3270331eb4..3ae6628fe5 100644 --- a/src/plugins/legacy/iterativeClosestPoint/CMakeLists.txt +++ b/src/plugins/legacy/iterativeClosestPoint/CMakeLists.txt @@ -36,7 +36,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonCore CommonDataModel FiltersGeneral) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonDataModel vtkFiltersGeneral) +include(${VTK_USE_FILE}) ## ############################################################################# ## List Sources @@ -73,14 +74,12 @@ add_library(${TARGET_NAME} SHARED target_link_libraries(${TARGET_NAME} ${QT_LIBRARIES} + ${VTK_LIBRARIES} medCore medVtkInria medUtilities - ${VTK_LIBRARIES} ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ## ############################################################################# diff --git a/src/plugins/legacy/itkDataImage/limit/vtkLimitVectorsToVOI.cxx b/src/plugins/legacy/itkDataImage/limit/vtkLimitVectorsToVOI.cxx index d49c1fa17b..be88d86623 100644 --- a/src/plugins/legacy/itkDataImage/limit/vtkLimitVectorsToVOI.cxx +++ b/src/plugins/legacy/itkDataImage/limit/vtkLimitVectorsToVOI.cxx @@ -13,16 +13,8 @@ #include "vtkLimitVectorsToVOI.h" -#include -#include -#include -#include -#include -#include -#include #include #include -#include #include #include diff --git a/src/plugins/legacy/itkDataImage/tests/CMakeLists.txt b/src/plugins/legacy/itkDataImage/tests/CMakeLists.txt index 0fbb159385..12ba586518 100644 --- a/src/plugins/legacy/itkDataImage/tests/CMakeLists.txt +++ b/src/plugins/legacy/itkDataImage/tests/CMakeLists.txt @@ -38,8 +38,8 @@ create_test_sourcelist(${PROJECT_NAME}_TESTS ${PROJECT_NAME}.cxx ${${PROJECT_NAME}_TESTS_FILENAME} ) -if(ITK_ROOT) - set(ITK_DATA_ROOT ${ITK_ROOT}/Examples/Data) +if(ITK_DIR) + set(ITK_DATA_ROOT ${ITK_DIR}/Examples/Data) endif() if(MSVC_IDE) diff --git a/src/plugins/legacy/itkDataSHImage/CMakeLists.txt b/src/plugins/legacy/itkDataSHImage/CMakeLists.txt index 4a4cabf1a5..ddcbbbb3ae 100644 --- a/src/plugins/legacy/itkDataSHImage/CMakeLists.txt +++ b/src/plugins/legacy/itkDataSHImage/CMakeLists.txt @@ -35,7 +35,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKIOImageBase ITKIOMeta ) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonExecutionModel RenderingCore InteractionWidgets) +find_package(VTK REQUIRED COMPONENTS vtkCommonExecutionModel vtkRenderingCore vtkInteractionWidgets) +include(${VTK_USE_FILE}) if (APPLE OR WIN32) find_package(Boost REQUIRED) @@ -106,7 +107,6 @@ target_link_libraries(${TARGET_NAME} medLog medVtkInria medImageIO - ${VTK_LIBRARIES} ) diff --git a/src/plugins/legacy/itkDataSHImage/management/vtkSphericalHarmonicSource.h b/src/plugins/legacy/itkDataSHImage/management/vtkSphericalHarmonicSource.h index 04dc18aed0..4f162b96df 100644 --- a/src/plugins/legacy/itkDataSHImage/management/vtkSphericalHarmonicSource.h +++ b/src/plugins/legacy/itkDataSHImage/management/vtkSphericalHarmonicSource.h @@ -127,7 +127,7 @@ class vtkSphericalHarmonicSource: public vtkPolyDataAlgorithm { /** Set FlipVector On/Off If On, x direction is flipped in the * reconstruction directions defining the basis function*/ - vtkSetVector3Macro(FlipVector, bool); + vtkSetVector3Macro(FlipVector,const bool); /** Get FlipVector On/Off If On, x direction is flipped in the reconstruction * directions defining the basis function*/ diff --git a/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt b/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt index 63309cf1be..33ae107785 100644 --- a/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt +++ b/src/plugins/legacy/itkDataTensorImage/CMakeLists.txt @@ -34,8 +34,9 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKIOImageBase ITKIOMeta ITKIONRRD ITKIONIFTI) include(${ITK_USE_FILE}) - -find_package(VTK REQUIRED COMPONENTS CommonCore CommonExecutionModel RenderingCore ImagingCore InteractionStyle InteractionWidgets) + +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonExecutionModel vtkRenderingCore vtkImagingCore vtkInteractionStyle vtkInteractionWidgets) +include(${VTK_USE_FILE}) find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) @@ -120,9 +121,9 @@ target_link_libraries(${TARGET_NAME} medCore medLog medVtkInria - ${VTK_LIBRARIES} ) + ## ############################################################################# ## Install rules ## ############################################################################# diff --git a/src/plugins/legacy/manualRegistration/CMakeLists.txt b/src/plugins/legacy/manualRegistration/CMakeLists.txt index 171b8437f7..784fddf119 100644 --- a/src/plugins/legacy/manualRegistration/CMakeLists.txt +++ b/src/plugins/legacy/manualRegistration/CMakeLists.txt @@ -36,7 +36,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKIOImageBase ITKTransform ITKIOTransformBase ITKIOTransformInsightLegacy ITKRegistrationCommon ITKIOMeta) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonCore InteractionWidgets) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkInteractionWidgets) +include(${VTK_USE_FILE}) find_package(RPI REQUIRED) include(${RPI_USE_FILE}) @@ -82,7 +83,6 @@ target_link_libraries(${TARGET_NAME} medCore medRegistration medVtkInria - ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/medCreateMeshFromMask/CMakeLists.txt b/src/plugins/legacy/medCreateMeshFromMask/CMakeLists.txt index ba27f75049..6bab2d2d61 100644 --- a/src/plugins/legacy/medCreateMeshFromMask/CMakeLists.txt +++ b/src/plugins/legacy/medCreateMeshFromMask/CMakeLists.txt @@ -36,7 +36,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKVtkGlue) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonCore) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore) +include(${VTK_USE_FILE}) ## ############################################################################# ## List Sources @@ -77,7 +78,6 @@ target_link_libraries(${TARGET_NAME} medVtkInria medUtilities ITKVtkGlue - VTK::CommonCore ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/medExportVideo/CMakeLists.txt b/src/plugins/legacy/medExportVideo/CMakeLists.txt index e88c5bc9cf..f3cbce4673 100644 --- a/src/plugins/legacy/medExportVideo/CMakeLists.txt +++ b/src/plugins/legacy/medExportVideo/CMakeLists.txt @@ -31,8 +31,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE) ## ############################################################################# if(${USE_FFmpeg}) - set (VTK_FFmpeg_MODULE IOFFMPEG) - set (VTK_FFmpeg_MODULE_LIB VTK::IOFFMPEG) + set (VTK_FFmpeg_MODULE vtkIOFFMPEG) add_definitions(-DMED_USE_FFmpeg) endif() @@ -42,7 +41,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonCore ImagingSources ${VTK_FFmpeg_MODULE} IOImage RenderingQt IOMovie) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkImagingSources ${VTK_FFmpeg_MODULE} vtkIOImage vtkRenderingQt vtkIOMovie) +include(${VTK_USE_FILE}) ## ############################################################################# ## List Sources @@ -83,12 +83,13 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities - ${VTK_LIBRARIES} - ${VTK_FFmpeg_MODULE_LIB} + vtkImagingSources + vtkIOImage + vtkIOMovie + vtkRenderingQt + ${VTK_FFmpeg_MODULE} ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ## ############################################################################# diff --git a/src/plugins/legacy/medRemeshing/CMakeLists.txt b/src/plugins/legacy/medRemeshing/CMakeLists.txt index 167e8e59ca..6a20e504dc 100644 --- a/src/plugins/legacy/medRemeshing/CMakeLists.txt +++ b/src/plugins/legacy/medRemeshing/CMakeLists.txt @@ -36,9 +36,10 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonCore CommonDataModel FiltersCore - FiltersModeling RenderingCore InteractionStyle - InteractionWidgets) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonDataModel vtkFiltersCore + vtkFiltersModeling vtkRenderingCore vtkInteractionStyle + vtkInteractionWidgets) +include(${VTK_USE_FILE}) ## ############################################################################# ## List Sources @@ -78,7 +79,6 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities - ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/medVtkFibersData/CMakeLists.txt b/src/plugins/legacy/medVtkFibersData/CMakeLists.txt index f1b568b1e1..216b17baf7 100644 --- a/src/plugins/legacy/medVtkFibersData/CMakeLists.txt +++ b/src/plugins/legacy/medVtkFibersData/CMakeLists.txt @@ -32,8 +32,8 @@ add_definitions(-D${TARGET_NAME_UP}_VERSION="${${TARGET_NAME}_VERSION}") find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) -find_package(VTK REQUIRED COMPONENTS ImagingCore IOLegacy IOXML RenderingCore RenderingOpenGL2 - InteractionWidgets CommonDataModel FiltersParallel) +find_package(VTK REQUIRED COMPONENTS vtkImagingCore vtkIOLegacy vtkIOXML vtkRenderingCore vtkRenderingOpenGL2 vtkInteractionWidgets) +include(${VTK_USE_FILE}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKVtkGlue) include(${ITK_USE_FILE}) @@ -109,10 +109,8 @@ target_link_libraries(${TARGET_NAME} TTK::ITKTensor ITKCommon ITKVtkGlue - ${VTK_LIBRARIES} ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## Install rules diff --git a/src/plugins/legacy/medVtkFibersData/interactors/medVtkFibersDataInteractor.cpp b/src/plugins/legacy/medVtkFibersData/interactors/medVtkFibersDataInteractor.cpp index 9e6bdac2cf..e28fa3f044 100644 --- a/src/plugins/legacy/medVtkFibersData/interactors/medVtkFibersDataInteractor.cpp +++ b/src/plugins/legacy/medVtkFibersData/interactors/medVtkFibersDataInteractor.cpp @@ -912,7 +912,7 @@ void medVtkFibersDataInteractor::bundleImageStatistics (const QString &bundleNam continue; vtkIdType npts = 0; - vtkIdType const *ptids = nullptr; + vtkIdType* ptids = 0; vtkIdType test = lines->GetNextCell (npts, ptids); double sumData = 0; @@ -992,7 +992,7 @@ void medVtkFibersDataInteractor::computeBundleLengthStatistics (const QString &n lines->InitTraversal(); vtkIdType npts = 0; - vtkIdType const *ptids = nullptr; + vtkIdType* ptids = 0; vtkIdType test = lines->GetNextCell (npts, ptids); double sumData = 0; diff --git a/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToROI.cxx b/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToROI.cxx index 4321574213..63215d3d5f 100644 --- a/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToROI.cxx +++ b/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToROI.cxx @@ -166,7 +166,7 @@ int vtkLimitFibersToROI::RequestData (vtkInformation *vtkNotUsed(request), lines->InitTraversal(); vtkIdType npts = 0; - vtkIdType const *ptids = nullptr; + vtkIdType* ptids = 0; vtkIdType test = lines->GetNextCell (npts, ptids); int cellId = 0; diff --git a/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToVOI.cxx b/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToVOI.cxx index 83d105437b..e5b955ae31 100644 --- a/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToVOI.cxx +++ b/src/plugins/legacy/medVtkFibersData/limit/vtkLimitFibersToVOI.cxx @@ -94,7 +94,7 @@ int vtkLimitFibersToVOI::RequestData (vtkInformation *vtkNotUsed(request), vtkIdType npt = 0; - vtkIdType const *pto = nullptr; + vtkIdType *pto = 0; vtkIdType test = lines->GetNextCell (npt, pto); vtkIdType cellId = 0; diff --git a/src/plugins/legacy/medVtkFibersData/manager/vtkFiberPickerCallback.cpp b/src/plugins/legacy/medVtkFibersData/manager/vtkFiberPickerCallback.cpp index 65331cf68f..9a7bb64dc2 100644 --- a/src/plugins/legacy/medVtkFibersData/manager/vtkFiberPickerCallback.cpp +++ b/src/plugins/legacy/medVtkFibersData/manager/vtkFiberPickerCallback.cpp @@ -114,8 +114,7 @@ void vtkFiberPickerCallback::DeletePickedCell() } realLines->InitTraversal(); - vtkIdType rnpts = 0; - vtkIdType const *rpto = nullptr; + vtkIdType rnpts, *rpto; vtkIdType test = realLines->GetNextCell (rnpts, rpto); int cellid = 0; @@ -131,17 +130,10 @@ void vtkFiberPickerCallback::DeletePickedCell() if( i==npts && pto[i-1]==rpto[i-1]) { - // Avoid const* - vtkIdType *nonConstRpto = nullptr; - for (int j=0; jFiberImage->Modified(); diff --git a/src/plugins/legacy/medVtkFibersData/readers/vtkXMLFiberDataSetReader.cxx b/src/plugins/legacy/medVtkFibersData/readers/vtkXMLFiberDataSetReader.cxx index 013bab93dd..be1c6c5d97 100644 --- a/src/plugins/legacy/medVtkFibersData/readers/vtkXMLFiberDataSetReader.cxx +++ b/src/plugins/legacy/medVtkFibersData/readers/vtkXMLFiberDataSetReader.cxx @@ -26,7 +26,6 @@ #include "vtkInformationVector.h" #include #include -#include vtkStandardNewMacro(vtkXMLFiberDataSetReader); diff --git a/src/plugins/legacy/medVtkView/CMakeLists.txt b/src/plugins/legacy/medVtkView/CMakeLists.txt index d88b7d0e20..d853feb02f 100644 --- a/src/plugins/legacy/medVtkView/CMakeLists.txt +++ b/src/plugins/legacy/medVtkView/CMakeLists.txt @@ -32,7 +32,8 @@ add_definitions(-D${TARGET_NAME_UP}_VERSION="${${TARGET_NAME}_VERSION}") find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) -find_package(VTK REQUIRED COMPONENTS InteractionWidgets GUISupportQt) +find_package(VTK REQUIRED COMPONENTS vtkGUISupportQt vtkInteractionWidgets) +include(${VTK_USE_FILE}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) @@ -82,11 +83,11 @@ target_link_libraries(${TARGET_NAME} dtkLog medCore medVtkInria + vtkGUISupportQt + vtkGUISupportQtOpenGL medVtkDataMeshBase - ${VTK_LIBRARIES} ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## Install rules diff --git a/src/plugins/legacy/medVtkView/medVtkView.cpp b/src/plugins/legacy/medVtkView/medVtkView.cpp index 71378e2cb7..b8e5a2c1c7 100644 --- a/src/plugins/legacy/medVtkView/medVtkView.cpp +++ b/src/plugins/legacy/medVtkView/medVtkView.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include @@ -64,7 +64,7 @@ class medVtkViewPrivate vtkImageView3D *view3d; vtkGenericOpenGLRenderWindow *renWin; - QVTKOpenGLNativeWidget *viewWidget; + QVTKOpenGLWidget *viewWidget; medVtkViewObserver *observer; @@ -127,9 +127,9 @@ medVtkView::medVtkView(QObject* parent): medAbstractImageView(parent), d->view3d->SetInteractorStyle(interactorStyle); interactorStyle->Delete(); - d->viewWidget = new QVTKOpenGLNativeWidget(); + d->viewWidget = new QVTKOpenGLWidget(); d->viewWidget->setEnableHiDPI(true); - d->viewWidget->setRenderWindow(d->renWin); + d->viewWidget->SetRenderWindow(d->renWin); // Event filter used to know if the view is selected or not d->viewWidget->installEventFilter(this); diff --git a/src/plugins/legacy/meshManipulation/CMakeLists.txt b/src/plugins/legacy/meshManipulation/CMakeLists.txt index c006f16ffd..3607f38212 100644 --- a/src/plugins/legacy/meshManipulation/CMakeLists.txt +++ b/src/plugins/legacy/meshManipulation/CMakeLists.txt @@ -36,7 +36,9 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonCore RenderingCore InteractionStyle InteractionWidgets) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkRenderingCore vtkInteractionStyle + vtkInteractionWidgets) +include(${VTK_USE_FILE}) ## ############################################################################# ## List Sources @@ -76,7 +78,6 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities - ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/meshMapping/CMakeLists.txt b/src/plugins/legacy/meshMapping/CMakeLists.txt index 3e1ec39a4b..e5680c4df1 100644 --- a/src/plugins/legacy/meshMapping/CMakeLists.txt +++ b/src/plugins/legacy/meshMapping/CMakeLists.txt @@ -36,7 +36,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKVtkGlue) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonCore ImagingCore ImagingGeneral FiltersCore FiltersGeneral) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkImagingCore vtkImagingGeneral vtkFiltersCore vtkFiltersGeneral) +include(${VTK_USE_FILE}) ## ############################################################################# ## List Sources @@ -77,7 +78,6 @@ target_link_libraries(${TARGET_NAME} medVtkInria medUtilities ITKVtkGlue - ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/meshMapping/meshMapping.cpp b/src/plugins/legacy/meshMapping/meshMapping.cpp index 59aca1afa6..cbef3dc577 100644 --- a/src/plugins/legacy/meshMapping/meshMapping.cpp +++ b/src/plugins/legacy/meshMapping/meshMapping.cpp @@ -10,20 +10,30 @@ PURPOSE. =========================================================================*/ -#include "meshMapping.h" +#include +#include #include +#include #include +#include #include -#include +#include +#include +#include +#include #include #include #include -#include #include #include +#include +#include +#include + +#include // ///////////////////////////////////////////////////////////////// // meshMappingPrivate @@ -38,56 +48,77 @@ class meshMappingPrivate template int mapImageOnMesh() { + typedef itk::Image ImageType; + if ( !data ||!data->data() || !structure ||!structure->data()) { return medAbstractProcessLegacy::FAILURE; } - // Get the mesh polydata and create an output polydata + //Converting the mesh if(!structure->identifier().contains("vtkDataMesh")) { return medAbstractProcessLegacy::MESH_TYPE; } + vtkMetaDataSet *structureDataset = static_cast(structure->data()); vtkPolyData *structurePolydata = static_cast(structureDataset->GetDataSet()); - vtkSmartPointer structurePolydataCopy = vtkSmartPointer::New(); - structurePolydataCopy->DeepCopy(structurePolydata); - // Get the ITK data - using ImageType = itk::Image; + // Converting the image + typedef itk::ImageToVTKImageFilter FilterType; + typename FilterType::Pointer filter = FilterType::New(); typename ImageType::Pointer img = static_cast(data->data()); + filter->SetInput(img); + filter->Update(); - // Create a new point data array for the interpolated values - vtkSmartPointer interpolatedValues = vtkSmartPointer::New(); - interpolatedValues->SetName("MappedValues"); - interpolatedValues->SetNumberOfComponents(1); - interpolatedValues->SetNumberOfTuples(structurePolydataCopy->GetNumberOfPoints()); - - // Fill the data array of points from the VTK with values from the ITK data - typename ImageType::IndexType itkIndex; - typename ImageType::PointType itkPoint; - double point[3]; - vtkPoints* points = structurePolydataCopy->GetPoints(); - for (vtkIdType i = 0; i < structurePolydataCopy->GetNumberOfPoints(); ++i) - { - points->GetPoint(i, point); - for (int d = 0; d < 3; ++d) - { - itkPoint[d] = point[d]; - } - - itkIndex = img->TransformPhysicalPointToIndex(itkPoint); - typename ImageType::PixelType pixelValue = img->GetPixel(itkIndex); - if (!std::isnan(static_cast(pixelValue))) + // ----- Hack to keep the itkImages info (origin and orientation) + vtkMatrix4x4 *matrix = vtkMatrix4x4::New(); + matrix->Identity(); + for (unsigned int x=0; x<3; x++) + { + for (unsigned int y=0; y<3; y++) { - interpolatedValues->SetValue(i, static_cast(pixelValue)); + matrix->SetElement(x, y, img->GetDirection()[x][y]); } } - structurePolydataCopy->GetPointData()->SetScalars(interpolatedValues); + typename itk::ImageBase<3>::PointType origin = img->GetOrigin(); + double v_origin[4], v_origin2[4]; + for (int i=0; i<3; i++) + { + v_origin[i] = origin[i]; + } + v_origin[3] = 1.0; + matrix->MultiplyPoint (v_origin, v_origin2); + for (int i=0; i<3; i++) + { + matrix->SetElement (i, 3, v_origin[i]-v_origin2[i]); + } + //------------------------------------------------------ + + vtkImageData *vtkImage = filter->GetOutput(); + + vtkImageCast *cast = vtkImageCast::New(); + cast->SetInputData(vtkImage); + cast->SetOutputScalarTypeToFloat(); + + //To get the itkImage infos back + vtkSmartPointer t = vtkSmartPointer::New(); + t->SetMatrix(matrix); + + vtkSmartPointer transformFilter = vtkSmartPointer::New(); + transformFilter->SetInputConnection(cast->GetOutputPort()); + transformFilter->SetTransform(t); + + // Probe magnitude with iso-surface. + vtkProbeFilter *probe = vtkProbeFilter::New(); + probe->SetInputData(structurePolydata); + probe->SetSourceConnection(transformFilter->GetOutputPort()); + probe->SpatialMatchOn(); + probe->Update(); + vtkPolyData *polydata = probe->GetPolyDataOutput(); - // Create output vtkMetaSurfaceMesh *smesh = vtkMetaSurfaceMesh::New(); - smesh->SetDataSet(structurePolydataCopy); + smesh->SetDataSet(polydata); output = medAbstractDataFactory::instance()->createSmartPointer("vtkDataMesh"); output->setData(smesh); @@ -190,6 +221,11 @@ void meshMapping::setInput(medAbstractData *data, int channel) } } +void meshMapping::setParameter(double data, int channel) +{ + // Here comes a switch over channel to handle parameters +} + int meshMapping::update() { int res = medAbstractProcessLegacy::FAILURE; diff --git a/src/plugins/legacy/meshMapping/meshMapping.h b/src/plugins/legacy/meshMapping/meshMapping.h index 120ade46ef..a01686b6a9 100644 --- a/src/plugins/legacy/meshMapping/meshMapping.h +++ b/src/plugins/legacy/meshMapping/meshMapping.h @@ -38,6 +38,9 @@ public slots: //! Input data to the plugin is set through here void setInput(medAbstractData *data, int channel); + + //! Parameters are set through here, channel allows to handle multiple parameters + void setParameter(double data, int channel); //! Method to actually start the filter int update(); @@ -45,6 +48,7 @@ public slots: //! The output will be available through here medAbstractData *output(); + private: meshMappingPrivate *d; }; diff --git a/src/plugins/legacy/polygonRoi/CMakeLists.txt b/src/plugins/legacy/polygonRoi/CMakeLists.txt index faf07c2f22..e1aa88a447 100644 --- a/src/plugins/legacy/polygonRoi/CMakeLists.txt +++ b/src/plugins/legacy/polygonRoi/CMakeLists.txt @@ -39,7 +39,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKImageLabel ITKVtkGlue ITKIOImageBase ITKIOMeta) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS GUISupportQt CommonCore IOLegacy) +find_package(VTK REQUIRED COMPONENTS vtkGUISupportQt vtkCommonCore vtkIOLegacy) +include(${VTK_USE_FILE}) find_package(Qt5 REQUIRED COMPONENTS Gui) @@ -92,11 +93,9 @@ target_link_libraries(${TARGET_NAME} medRegistration medVtkInria medUtilities - ${VTK_LIBRARIES} + vtkCommonComputationalGeometry ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ## ############################################################################# diff --git a/src/plugins/legacy/reformat/CMakeLists.txt b/src/plugins/legacy/reformat/CMakeLists.txt index 076b2bc6f2..15be99de99 100644 --- a/src/plugins/legacy/reformat/CMakeLists.txt +++ b/src/plugins/legacy/reformat/CMakeLists.txt @@ -36,7 +36,8 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon ITKImageGrid ITKVtkGlue) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS InteractionWidgets InteractionImage GUISupportQt) +find_package(VTK REQUIRED COMPONENTS vtkGUISupportQt vtkInteractionWidgets vtkInteractionImage) +include(${VTK_USE_FILE}) ## ############################################################################# ## List Sources @@ -78,11 +79,11 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities - ${VTK_LIBRARIES} + vtkInteractionImage + vtkGUISupportQt + vtkGUISupportQtOpenGL ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ## ############################################################################# diff --git a/src/plugins/legacy/reformat/medResliceViewer.cpp b/src/plugins/legacy/reformat/medResliceViewer.cpp index 6b8af747f6..56003b649a 100644 --- a/src/plugins/legacy/reformat/medResliceViewer.cpp +++ b/src/plugins/legacy/reformat/medResliceViewer.cpp @@ -10,7 +10,6 @@ PURPOSE. =========================================================================*/ - #include "medResliceViewer.h" #include "resampleProcess.h" @@ -28,8 +27,11 @@ #include #include #include +#include #include #include +#include +#include #include #include #include @@ -38,7 +40,7 @@ #include #include #include -#include +#include #include #include @@ -67,25 +69,25 @@ class medResliceCursorCallback : public vtkCommand } } - vtkImagePlaneWidget *ipw = dynamic_cast(caller); + vtkImagePlaneWidget *ipw = dynamic_cast< vtkImagePlaneWidget* >(caller); if (ipw) { double *wl = static_cast(callData); - if (ipw == IPW[0]) + if (ipw == reformatViewer->getImagePlaneWidget(0)) { - IPW[1]->SetWindowLevel(wl[0], wl[1], 1); - IPW[2]->SetWindowLevel(wl[0], wl[1], 1); + reformatViewer->getImagePlaneWidget(1)->SetWindowLevel(wl[0],wl[1],1); + reformatViewer->getImagePlaneWidget(2)->SetWindowLevel(wl[0],wl[1],1); } - else if (ipw == IPW[1]) + else if(ipw == reformatViewer->getImagePlaneWidget(1)) { - IPW[0]->SetWindowLevel(wl[0], wl[1], 1); - IPW[2]->SetWindowLevel(wl[0], wl[1], 1); + reformatViewer->getImagePlaneWidget(0)->SetWindowLevel(wl[0],wl[1],1); + reformatViewer->getImagePlaneWidget(2)->SetWindowLevel(wl[0],wl[1],1); } - else if (ipw == IPW[2]) + else if (ipw == reformatViewer->getImagePlaneWidget(2)) { - IPW[0]->SetWindowLevel(wl[0], wl[1], 1); - IPW[1]->SetWindowLevel(wl[0], wl[1], 1); + reformatViewer->getImagePlaneWidget(0)->SetWindowLevel(wl[0],wl[1],1); + reformatViewer->getImagePlaneWidget(1)->SetWindowLevel(wl[0],wl[1],1); } } @@ -96,27 +98,28 @@ class medResliceCursorCallback : public vtkCommand // Although the return value is not used, we keep the get calls // in case they had side-effects rep->GetResliceCursorActor()->GetCursorAlgorithm()->GetResliceCursor(); + for (int i = 0; i < 3; i++) { - vtkPlaneSource *ps = static_cast(IPW[i]->GetPolyDataAlgorithm()); - ps->SetOrigin( - RCW[i]->GetResliceCursorRepresentation()->GetPlaneSource()->GetOrigin()); - ps->SetPoint1( - RCW[i]->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint1()); - ps->SetPoint2( - RCW[i]->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint2()); + vtkPlaneSource *ps = static_cast< vtkPlaneSource * >(reformatViewer->getImagePlaneWidget(i)->GetPolyDataAlgorithm()); + ps->SetOrigin(reformatViewer->getResliceImageViewer(i)->GetResliceCursorWidget() + ->GetResliceCursorRepresentation()->GetPlaneSource()->GetOrigin()); + ps->SetPoint1(reformatViewer->getResliceImageViewer(i)->GetResliceCursorWidget() + ->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint1()); + ps->SetPoint2(reformatViewer->getResliceImageViewer(i)->GetResliceCursorWidget() + ->GetResliceCursorRepresentation()->GetPlaneSource()->GetPoint2()); // If the reslice plane has modified, update it on the 3D widget - IPW[i]->UpdatePlacement(); + reformatViewer->getImagePlaneWidget(i)->UpdatePlacement(); } } // Render everything for (int i = 0; i < 3; i++) { - RCW[i]->Render(); + reformatViewer->getResliceImageViewer(i)->GetResliceCursorWidget()->Render(); } - IPW[0]->GetInteractor()->GetRenderWindow()->Render(); + reformatViewer->getImagePlaneWidget(0)->GetInteractor()->GetRenderWindow()->Render(); } ~medResliceCursorCallback() @@ -124,10 +127,6 @@ class medResliceCursorCallback : public vtkCommand reformatViewer = nullptr; } - medResliceCursorCallback() = default; - - vtkImagePlaneWidget* IPW[3]; - vtkResliceCursorWidget* RCW[3]; medResliceViewer *reformatViewer; }; @@ -161,13 +160,14 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA riw[i] = vtkSmartPointer::New(); vtkNew renderWindow; riw[i]->SetRenderWindow(renderWindow); + riw[i]->GetRenderer()->SetBackground(0,0,0); // black background } riw[selectedView]->GetRenderer()->SetBackground(0.3,0,0); // Build views for (int i = 0; i < 4; i++) { - views[i] = new QVTKOpenGLNativeWidget(); + views[i] = new QVTKOpenGLWidget(); views[i]->setEnableHiDPI(true); views[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); views[i]->installEventFilter(this); @@ -190,37 +190,32 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA viewBody->setLayout(gridLayout); // Share render windows and interactors - views[0]->setRenderWindow(riw[0]->GetRenderWindow()); - riw[0]->SetupInteractor(views[0]->renderWindow()->GetInteractor()); + views[0]->SetRenderWindow(riw[0]->GetRenderWindow()); + riw[0]->SetupInteractor(views[0]->GetRenderWindow()->GetInteractor()); - views[1]->setRenderWindow(riw[1]->GetRenderWindow()); - riw[1]->SetupInteractor(views[1]->renderWindow()->GetInteractor()); + views[1]->SetRenderWindow(riw[1]->GetRenderWindow()); + riw[1]->SetupInteractor(views[1]->GetRenderWindow()->GetInteractor()); - views[2]->setRenderWindow(riw[2]->GetRenderWindow()); - riw[2]->SetupInteractor(views[2]->renderWindow()->GetInteractor()); + views[2]->SetRenderWindow(riw[2]->GetRenderWindow()); + riw[2]->SetupInteractor(views[2]->GetRenderWindow()->GetInteractor()); vtkSmartPointer ren = vtkSmartPointer::New(); vtkNew renderWindow; - views[3]->setRenderWindow(renderWindow); - views[3]->renderWindow()->AddRenderer(ren); + views[3]->SetRenderWindow(renderWindow); + views[3]->GetRenderWindow()->AddRenderer(ren); // Make them all share the same reslice cursor object. for (int i = 0; i < 3; i++) { vtkResliceCursorLineRepresentation *rep = vtkResliceCursorLineRepresentation::SafeDownCast( - riw[i]->GetResliceCursorWidget()->GetRepresentation()); + riw[i]->GetResliceCursorWidget()->GetRepresentation()); riw[i]->SetResliceCursor(riw[selectedView]->GetResliceCursor()); rep->GetResliceCursorActor()->GetCursorAlgorithm()->SetReslicePlaneNormal(i); + riw[i]->SetInputData(vtkViewData); riw[i]->SetSliceOrientation(i); riw[i]->SetResliceModeToOblique(); - - // Due to a bug since ~VTK9 https://gitlab.kitware.com/vtk/vtk/-/issues/18441 - // the plans are not displayed correctly. A temporary solution is to use a wireframe representation. - rep->GetResliceCursorActor()->GetCenterlineProperty(0)->SetRepresentationToWireframe(); - rep->GetResliceCursorActor()->GetCenterlineProperty(1)->SetRepresentationToWireframe(); - rep->GetResliceCursorActor()->GetCenterlineProperty(2)->SetRepresentationToWireframe(); } vtkSmartPointer picker = vtkSmartPointer::New(); @@ -228,7 +223,7 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA vtkSmartPointer ipwProp = vtkSmartPointer::New(); - vtkRenderWindowInteractor *iren = views[3]->interactor(); + vtkRenderWindowInteractor *iren = views[3]->GetInteractor(); // Build planes on views for (int i = 0; i < 3; i++) @@ -246,7 +241,7 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA planeWidget[i]->SetTexturePlaneProperty(ipwProp); planeWidget[i]->TextureInterpolateOff(); planeWidget[i]->SetResliceInterpolateToLinear(); - planeWidget[i]->SetInputConnection(view3d->GetInputAlgorithm(view3d->GetCurrentLayer())->GetOutputPort()); + planeWidget[i]->SetInputData(vtkViewData); planeWidget[i]->SetPlaneOrientation(i); planeWidget[i]->SetSliceIndex(imageDims[i]/2); planeWidget[i]->DisplayTextOn(); @@ -260,30 +255,25 @@ medResliceViewer::medResliceViewer(medAbstractView *view, QWidget *parent): medA for (int i = 0; i < 3; i++) { - cbk->IPW[i] = planeWidget[i]; - cbk->RCW[i] = riw[i]->GetResliceCursorWidget(); - riw[i]->GetResliceCursorWidget()->AddObserver(vtkResliceCursorWidget::ResliceAxesChangedEvent, cbk); riw[i]->GetResliceCursorWidget()->AddObserver(vtkResliceCursorWidget::WindowLevelEvent, cbk); riw[i]->GetResliceCursorWidget()->AddObserver(vtkResliceCursorWidget::ResliceThicknessChangedEvent, cbk); riw[i]->GetResliceCursorWidget()->AddObserver(vtkResliceCursorWidget::ResetCursorEvent, cbk); riw[i]->GetInteractorStyle()->AddObserver(vtkCommand::WindowLevelEvent, cbk); + riw[i]->GetInteractorStyle()->AddObserver(vtkCommand::MouseMoveEvent, cbk); // Make them all share the same color map. riw[i]->SetLookupTable(riw[selectedView]->GetLookupTable()); - planeWidget[i]->GetColorMap()->SetLookupTable(riw[selectedView]->GetLookupTable()); - planeWidget[i]->SetColorMap(riw[i]->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetColorMap()); - - // Get back and apply the color level and color window from the original view riw[i]->SetColorLevel(view3d->GetColorLevel()); riw[i]->SetColorWindow(view3d->GetColorWindow()); + planeWidget[i]->GetColorMap()->SetLookupTable(riw[selectedView]->GetLookupTable()); + planeWidget[i]->SetColorMap(riw[i]->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetColorMap()); } resetViews(); applyRadiologicalConvention(); updatePlaneNormals(); - // Turn the 3D view in the radiological convention planeWidget[0]->GetCurrentRenderer()->ResetCamera(); planeWidget[0]->GetCurrentRenderer()->GetActiveCamera()->Azimuth(180); planeWidget[0]->GetCurrentRenderer()->GetActiveCamera()->Roll(180); @@ -321,10 +311,46 @@ void medResliceViewer::thickMode(int val) for (int i = 0; i < 3; i++) { riw[i]->SetThickMode(val); + riw[i]->GetRenderer()->ResetCamera(); riw[i]->Render(); } } +void medResliceViewer::blendMode(int val) +{ + if (val) + { + SetBlendModeToMinIP(); + } +} + +void medResliceViewer::SetBlendMode(int m) +{ + for (int i = 0; i < 3; i++) + { + vtkImageSlabReslice *thickSlabReslice = vtkImageSlabReslice::SafeDownCast( + vtkResliceCursorThickLineRepresentation::SafeDownCast( + riw[i]->GetResliceCursorWidget()->GetRepresentation())->GetReslice()); + thickSlabReslice->SetBlendMode(m); + riw[i]->Render(); + } +} + +void medResliceViewer::SetBlendModeToMaxIP() +{ + this->SetBlendMode(VTK_IMAGE_SLAB_MAX); +} + +void medResliceViewer::SetBlendModeToMinIP() +{ + this->SetBlendMode(VTK_IMAGE_SLAB_MIN); +} + +void medResliceViewer::SetBlendModeToMeanIP() +{ + this->SetBlendMode(VTK_IMAGE_SLAB_MEAN); +} + void medResliceViewer::reset() { resetViews(); @@ -347,8 +373,8 @@ void medResliceViewer::render() for (int i = 0; i < 3; i++) { riw[i]->Render(); + views[i]->GetRenderWindow()->Render(); } - views[2]->renderWindow()->Render(); } void medResliceViewer::saveImage() @@ -473,7 +499,7 @@ void medResliceViewer::extentChanged(int val) bool medResliceViewer::eventFilter(QObject *object, QEvent *event) { - if (!qobject_cast(object)) + if (!qobject_cast(object)) { return true; } @@ -518,15 +544,14 @@ dtkSmartPointer medResliceViewer::getOutput() void medResliceViewer::applyRadiologicalConvention() { double normal[3]; - auto resliceCursor = getResliceImageViewer(0)->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetResliceCursor(); - resliceCursor->GetPlane(2)->GetNormal(normal); + + getResliceImageViewer(0)->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetResliceCursor()->GetPlane(2)->GetNormal(normal); for (int i = 0; i < 3; i++) { normal[i] = -normal[i]; } - resliceCursor->GetPlane(2)->SetNormal(normal); - resliceCursor->Update(); - + getResliceImageViewer(0)->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetResliceCursor()->GetPlane(2)->SetNormal(normal); + getResliceImageViewer(0)->GetResliceCursorWidget()->GetResliceCursorRepresentation()->GetResliceCursor()->Update(); for (int i = 0; i < 3; i++) { getResliceImageViewer(i)->GetResliceCursorWidget()->Render(); diff --git a/src/plugins/legacy/reformat/medResliceViewer.h b/src/plugins/legacy/reformat/medResliceViewer.h index 1940cd9a62..e0d807a128 100644 --- a/src/plugins/legacy/reformat/medResliceViewer.h +++ b/src/plugins/legacy/reformat/medResliceViewer.h @@ -12,7 +12,6 @@ PURPOSE. =========================================================================*/ - #include "resliceToolBox.h" #include @@ -22,7 +21,7 @@ PURPOSE. #include -#include +#include #include #include @@ -54,6 +53,11 @@ class medResliceViewer : public medAbstractView public slots: virtual void thickMode(int); + virtual void blendMode(int); + virtual void SetBlendModeToMaxIP(); + virtual void SetBlendModeToMinIP(); + virtual void SetBlendModeToMeanIP(); + virtual void SetBlendMode(int); virtual void reset(); virtual void resetViews(); virtual void render(); @@ -79,7 +83,7 @@ public slots: vtkSmartPointer planeWidget[3]; double planeNormal[3][3]; QWidget *viewBody; - QVTKOpenGLNativeWidget *views[4]; + QVTKOpenGLWidget *views[4]; dtkSmartPointer inputData; std::array outputSpacingOrSize; unsigned char selectedView; diff --git a/src/plugins/legacy/variationalSegmentation/CMakeLists.txt b/src/plugins/legacy/variationalSegmentation/CMakeLists.txt index e19ccc8557..2c6b6f9707 100644 --- a/src/plugins/legacy/variationalSegmentation/CMakeLists.txt +++ b/src/plugins/legacy/variationalSegmentation/CMakeLists.txt @@ -37,7 +37,8 @@ find_package(ITK REQUIRED COMPONENTS ITKCommon ITKImageFilterBase ITKThresholdin ITKVtkGlue) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonCore InteractionWidgets RenderingCore) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkInteractionWidgets vtkRenderingCore) +include(${VTK_USE_FILE}) ## ############################################################################# ## List Sources @@ -79,7 +80,6 @@ target_link_libraries(${TARGET_NAME} medUtilities ITKVTK ITKTransform - ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/voiCutter/CMakeLists.txt b/src/plugins/legacy/voiCutter/CMakeLists.txt index 1a42780da2..6820fd5141 100644 --- a/src/plugins/legacy/voiCutter/CMakeLists.txt +++ b/src/plugins/legacy/voiCutter/CMakeLists.txt @@ -36,8 +36,9 @@ include_directories(${dtk_INCLUDE_DIRS}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) -find_package(VTK REQUIRED COMPONENTS CommonCore RenderingCore CommonDataModel - InteractionStyle InteractionWidgets) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkRenderingCore vtkCommonDataModel + vtkInteractionStyle vtkInteractionWidgets) +include(${VTK_USE_FILE}) ## ############################################################################# ## List Sources @@ -77,7 +78,6 @@ target_link_libraries(${TARGET_NAME} medCore medVtkInria medUtilities - ${VTK_LIBRARIES} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/plugins/legacy/vtkDataMesh/CMakeLists.txt b/src/plugins/legacy/vtkDataMesh/CMakeLists.txt index c6dfc9e6b9..b792cb2363 100644 --- a/src/plugins/legacy/vtkDataMesh/CMakeLists.txt +++ b/src/plugins/legacy/vtkDataMesh/CMakeLists.txt @@ -31,8 +31,8 @@ add_definitions(-D${TARGET_NAME_UP}_VERSION="${${TARGET_NAME}_VERSION}") find_package(dtk REQUIRED) include_directories(${dtk_INCLUDE_DIRS}) -find_package(VTK REQUIRED COMPONENTS CommonCore CommonDataModel RenderingCore RenderingVolumeOpenGL2 - InteractionStyle InteractionWidgets IOParallelXML IOImage IOGeometry IOExport RenderingContext2D) +find_package(VTK REQUIRED COMPONENTS vtkCommonCore vtkCommonDataModel vtkRenderingCore vtkRenderingVolumeOpenGL2 vtkInteractionStyle vtkInteractionWidgets vtkIOParallelXML vtkIOImage vtkIOGeometry vtkIOExport vtkRenderingContext2D) +include(${VTK_USE_FILE}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) @@ -100,11 +100,12 @@ target_link_libraries(${TARGET_NAME} medCore medLog medVtkInria + vtkIOXML + vtkIOCore + vtkIOLegacy medVtkDataMeshBase - ${VTK_LIBRARIES} ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) ## ############################################################################# ## Install rules diff --git a/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt b/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt index 4d521c9797..35ace7785b 100644 --- a/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt +++ b/src/plugins/process/ttkTensorScalarMapsProcess/CMakeLists.txt @@ -6,7 +6,8 @@ set(TARGET_NAME ttkTensorScalarMapsProcessPlugin) find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) -find_package(VTK REQUIRED COMPONENTS RenderingCore) +find_package(VTK REQUIRED COMPONENTS vtkRenderingCore) +include(${VTK_USE_FILE}) find_package(ITK REQUIRED COMPONENTS ITKCommon) include(${ITK_USE_FILE}) @@ -57,11 +58,9 @@ target_link_libraries(${TARGET_NAME} medCoreLegacy medVtkInria medWidgets - VTK::RenderingCore + vtkRenderingCore ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) - ## ################################################################# ## Install rules ## ################################################################# diff --git a/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt b/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt index 48ab64b95d..13314d64e2 100644 --- a/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt +++ b/src/plugins/process/ttkTensorTractographyProcess/CMakeLists.txt @@ -26,13 +26,13 @@ add_definitions(-D${TARGET_NAME_UP}_VERSION="${${TARGET_NAME}_VERSION}") ## Resolve dependencies ## ############################################################################# -find_package(VTK REQUIRED CommonCore CommonDataModel) +find_package(VTK REQUIRED vtkCommonCore vtkCommonDataModel) +include(${VTK_USE_FILE}) find_package(ITK REQUIRED ITKCommon ITKTransform ITKImageFunction) include(${ITK_USE_FILE}) find_package(TTK REQUIRED COMPONENTS ITKTensor ttkAlgorithms) - ## ############################################################################# ## List Sources ## ############################################################################# @@ -80,11 +80,9 @@ target_link_libraries(${TARGET_NAME} medCoreLegacy medVtkInria medWidgets - ${VTK_LIBRARIES} + vtkRenderingCore ) -vtk_module_autoinit(TARGETS ${TARGET_NAME} MODULES ${VTK_LIBRARIES}) - ## ################################################################# ## Install rules ## ################################################################# diff --git a/superbuild/patches/VTK.patch b/superbuild/patches/VTK.patch new file mode 100644 index 0000000000..2ba761e78c --- /dev/null +++ b/superbuild/patches/VTK.patch @@ -0,0 +1,193 @@ +diff --git a/CMake/VTKGenerateExportHeader.cmake b/CMake/VTKGenerateExportHeader.cmake +index 9a7a76386e..f71969ae54 100644 +--- a/CMake/VTKGenerateExportHeader.cmake ++++ b/CMake/VTKGenerateExportHeader.cmake +@@ -174,8 +174,12 @@ macro(_vtk_test_compiler_hidden_visibility) + execute_process(COMMAND ${CMAKE_C_COMPILER} --version + OUTPUT_VARIABLE _gcc_version_info + ERROR_VARIABLE _gcc_version_info) +- string(REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*" ++ string(REGEX MATCH "[1-9][0-9]\\.[0-9]\\.[0-9]*" + _gcc_version "${_gcc_version_info}") ++ if(NOT _gcc_version) ++ string(REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*" ++ _gcc_version "${_gcc_version_info}") ++ endif() + # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the + # patch level, handle this here: + if(NOT _gcc_version) +diff --git a/IO/Movie/module.cmake b/IO/Movie/module.cmake +index fd6d096384..071b4a20a2 100644 +--- a/IO/Movie/module.cmake ++++ b/IO/Movie/module.cmake +@@ -20,4 +20,5 @@ vtk_module(vtkIOMovie + vtkCommonDataModel + vtkCommonMisc + vtkCommonSystem ++ vtksys + ) +\ No newline at end of file +diff --git a/IO/Movie/vtkOggTheoraWriter.cxx b/IO/Movie/vtkOggTheoraWriter.cxx +index d24acde998..9dff50bb0e 100644 +--- a/IO/Movie/vtkOggTheoraWriter.cxx ++++ b/IO/Movie/vtkOggTheoraWriter.cxx +@@ -21,6 +21,8 @@ + + #include "vtk_oggtheora.h" + ++#include ++ + #include + + //--------------------------------------------------------------------------- +@@ -190,7 +192,7 @@ int vtkOggTheoraWriterInternal::Start() + th_info_clear(&thInfo); + + // Finally, open the file and start it off. +- this->outFile = fopen(this->Writer->GetFileName(),"wb"); ++ this->outFile = vtksys::SystemTools::Fopen(this->Writer->GetFileName(),"wb"); + if (!this->outFile) + { + vtkGenericWarningMacro(<< "Could not open " << this->Writer->GetFileName() << "." ); +diff --git a/Rendering/Qt/vtkQtLabelRenderStrategy.cxx b/Rendering/Qt/vtkQtLabelRenderStrategy.cxx +index 8bfd3f6b6b..2d5adb1834 100644 +--- a/Rendering/Qt/vtkQtLabelRenderStrategy.cxx ++++ b/Rendering/Qt/vtkQtLabelRenderStrategy.cxx +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/Rendering/Qt/vtkQtStringToImage.cxx b/Rendering/Qt/vtkQtStringToImage.cxx +index 549ffbe874..a7c726e4f9 100644 +--- a/Rendering/Qt/vtkQtStringToImage.cxx ++++ b/Rendering/Qt/vtkQtStringToImage.cxx +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx b/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx +index 2b0d443537..e18525a470 100644 +--- a/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx ++++ b/Wrapping/PythonCore/PyVTKMethodDescriptor.cxx +@@ -186,7 +186,7 @@ PyTypeObject PyVTKMethodDescriptor_Type = { + sizeof(PyMethodDescrObject), // tp_basicsize + 0, // tp_itemsize + PyVTKMethodDescriptor_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_print + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/PyVTKNamespace.cxx b/Wrapping/PythonCore/PyVTKNamespace.cxx +index 71ee2a3516..1c5f85c3d4 100644 +--- a/Wrapping/PythonCore/PyVTKNamespace.cxx ++++ b/Wrapping/PythonCore/PyVTKNamespace.cxx +@@ -49,7 +49,7 @@ PyTypeObject PyVTKNamespace_Type = { + 0, // tp_basicsize + 0, // tp_itemsize + PyVTKNamespace_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_print + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/PyVTKReference.cxx b/Wrapping/PythonCore/PyVTKReference.cxx +index 943ac71080..6f3e0130a8 100644 +--- a/Wrapping/PythonCore/PyVTKReference.cxx ++++ b/Wrapping/PythonCore/PyVTKReference.cxx +@@ -1010,7 +1010,7 @@ PyTypeObject PyVTKReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_print + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +@@ -1067,7 +1067,7 @@ PyTypeObject PyVTKNumberReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_print + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +@@ -1124,7 +1124,7 @@ PyTypeObject PyVTKStringReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_print + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +@@ -1181,7 +1181,7 @@ PyTypeObject PyVTKTupleReference_Type = { + sizeof(PyVTKReference), // tp_basicsize + 0, // tp_itemsize + PyVTKReference_Delete, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_print + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/PythonCore/PyVTKTemplate.cxx b/Wrapping/PythonCore/PyVTKTemplate.cxx +index be200985b3..ebc236ad5f 100644 +--- a/Wrapping/PythonCore/PyVTKTemplate.cxx ++++ b/Wrapping/PythonCore/PyVTKTemplate.cxx +@@ -268,7 +268,7 @@ PyTypeObject PyVTKTemplate_Type = { + 0, // tp_basicsize + 0, // tp_itemsize + nullptr, // tp_dealloc +- nullptr, // tp_print ++ 0, // tp_print + nullptr, // tp_getattr + nullptr, // tp_setattr + nullptr, // tp_compare +diff --git a/Wrapping/Tools/vtkWrapPythonClass.c b/Wrapping/Tools/vtkWrapPythonClass.c +index 989101b2ee..9a8b465acd 100644 +--- a/Wrapping/Tools/vtkWrapPythonClass.c ++++ b/Wrapping/Tools/vtkWrapPythonClass.c +@@ -527,7 +527,7 @@ void vtkWrapPython_GenerateObjectType( + " sizeof(PyVTKObject), // tp_basicsize\n" + " 0, // tp_itemsize\n" + " PyVTKObject_Delete, // tp_dealloc\n" +- " nullptr, // tp_print\n" ++ " 0, // tp_print\n" + " nullptr, // tp_getattr\n" + " nullptr, // tp_setattr\n" + " nullptr, // tp_compare\n" +diff --git a/Wrapping/Tools/vtkWrapPythonEnum.c b/Wrapping/Tools/vtkWrapPythonEnum.c +index b933702242..57c077490a 100644 +--- a/Wrapping/Tools/vtkWrapPythonEnum.c ++++ b/Wrapping/Tools/vtkWrapPythonEnum.c +@@ -145,7 +145,7 @@ void vtkWrapPython_GenerateEnumType( + " sizeof(PyIntObject), // tp_basicsize\n" + " 0, // tp_itemsize\n" + " nullptr, // tp_dealloc\n" +- " nullptr, // tp_print\n" ++ " 0, // tp_print\n" + " nullptr, // tp_getattr\n" + " nullptr, // tp_setattr\n" + " nullptr, // tp_compare\n" +diff --git a/Wrapping/Tools/vtkWrapPythonType.c b/Wrapping/Tools/vtkWrapPythonType.c +index 744cb1b9d3..f6361bcb26 100644 +--- a/Wrapping/Tools/vtkWrapPythonType.c ++++ b/Wrapping/Tools/vtkWrapPythonType.c +@@ -709,7 +709,7 @@ void vtkWrapPython_GenerateSpecialType( + " sizeof(PyVTKSpecialObject), // tp_basicsize\n" + " 0, // tp_itemsize\n" + " Py%s_Delete, // tp_dealloc\n" +- " nullptr, // tp_print\n" ++ " 0, // tp_print\n" + " nullptr, // tp_getattr\n" + " nullptr, // tp_setattr\n" + " nullptr, // tp_compare\n" diff --git a/superbuild/projects_modules/ITK.cmake b/superbuild/projects_modules/ITK.cmake index 5641d41491..9cf28d26e0 100644 --- a/superbuild/projects_modules/ITK.cmake +++ b/superbuild/projects_modules/ITK.cmake @@ -40,7 +40,7 @@ if (NOT USE_SYSTEM_${ep}) set(git_url ${GITHUB_PREFIX}InsightSoftwareConsortium/ITK.git) -set(git_tag v5.4rc04) +set(git_tag v5.2.1) ## ############################################################################# diff --git a/superbuild/projects_modules/LogDemons.cmake b/superbuild/projects_modules/LogDemons.cmake index 04648431b1..e65ecc9301 100644 --- a/superbuild/projects_modules/LogDemons.cmake +++ b/superbuild/projects_modules/LogDemons.cmake @@ -40,7 +40,7 @@ if (NOT USE_SYSTEM_${ep}) ## ############################################################################# set(git_url ${GITHUB_PREFIX}Inria-Asclepios/LCC-LogDemons.git) -set(git_tag ITK5.3rc04) +set(git_tag ITK5.1.1) ## ############################################################################# ## Add specific cmake arguments for configuration step of the project diff --git a/superbuild/projects_modules/RPI.cmake b/superbuild/projects_modules/RPI.cmake index 691879091a..25833c8221 100644 --- a/superbuild/projects_modules/RPI.cmake +++ b/superbuild/projects_modules/RPI.cmake @@ -40,8 +40,8 @@ if (NOT USE_SYSTEM_${ep}) ## Set up versioning control ## ############################################################################# -set(git_url ${GITHUB_PREFIX}Inria-Asclepios/RPI.git) -set(git_tag ITK5.4rc04) +set(git_url ${GITHUB_PREFIX}medInria/RPI.git) +set(git_tag ITK5.1.1) ## ############################################################################# ## Add specific cmake arguments for configuration step of the project diff --git a/superbuild/projects_modules/TTK.cmake b/superbuild/projects_modules/TTK.cmake index a001972182..9b46d4aaae 100644 --- a/superbuild/projects_modules/TTK.cmake +++ b/superbuild/projects_modules/TTK.cmake @@ -41,7 +41,7 @@ if (NOT USE_SYSTEM_${ep}) ## ############################################################################# set(git_url ${GITHUB_PREFIX}medInria/TTK.git) -set(git_tag ITK5.4rc04+VTK9) +set(git_tag ITK5.2.1) ## ############################################################################# ## Add specific cmake arguments for configuration step of the project diff --git a/superbuild/projects_modules/VTK.cmake b/superbuild/projects_modules/VTK.cmake index 6653049ca0..72d34cd3cd 100644 --- a/superbuild/projects_modules/VTK.cmake +++ b/superbuild/projects_modules/VTK.cmake @@ -43,7 +43,7 @@ if (NOT USE_SYSTEM_${ep}) ## ############################################################################# set(git_url ${GITHUB_PREFIX}Kitware/VTK.git) -set(git_tag v9.2.6) +set(git_tag v8.1.2) ## ############################################################################# @@ -72,14 +72,15 @@ set(cmake_args -DCMAKE_SHARED_LINKER_FLAGS=${${ep}_shared_linker_flags} -DCMAKE_INSTALL_PREFIX= -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS_${ep}} - -DVTK_BUILD_TESTING=OFF - -DVTK_BUILD_DOCUMENTATION=OFF - -DVTK_BUILD_EXAMPLES=OFF + -DBUILD_TESTING=OFF + -DBUILD_DOCUMENTATION=OFF + -DBUILD_EXAMPLES=OFF -DVTK_RENDERING_BACKEND=OpenGL2 + -DVTK_Group_Qt=ON + -DModule_vtkGUISupportQtOpenGL=ON + -DModule_vtkRenderingOSPRay:BOOL=${USE_OSPRay} -DVTK_QT_VERSION=5 - -DVTK_MODULE_ENABLE_VTK_GUISupportQt=YES - -DVTK_MODULE_ENABLE_VTK_RenderingQt=YES - -DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON + -DVTK_USE_OGGTHEORA_ENCODER:BOOL=ON # OGV Export ) set(cmake_cache_args @@ -88,7 +89,6 @@ set(cmake_cache_args if(USE_OSPRay) list(APPEND cmake_args - -DVTK_MODULE_ENABLE_VTK_RenderingOSPRay=YES -Dospray_DIR=${ospray_DIR} -DOSPRAY_INSTALL_DIR=${OSPRAY_INSTALL_DIR} ) @@ -98,7 +98,7 @@ endif() if(${USE_FFmpeg}) list(APPEND cmake_args # FFMPEG - -DVTK_MODULE_ENABLE_VTK_IOFFMPEG=YES + -DModule_vtkIOFFMPEG:BOOL=ON -DFFMPEG_ROOT:STRING=${EP_PATH_BUILD}/ffmpeg -DFFMPEG_INCLUDE_DIR:STRING=${EP_PATH_BUILD}/ffmpeg/include/ @@ -134,13 +134,19 @@ if(USE_Python) -DVTK_WRAP_PYTHON:BOOL=ON -DModule_vtkPython:BOOL=ON -DModule_vtkWrappingTools:BOOL=ON - -DVTK_PYTHON_VERSION:STRING=${PYTHON_VERSION_MAJOR} + -DVTK_PYTHON_VERSION:STRING=${python_version} -DPYTHON_EXECUTABLE:PATH=${python_executable} -DPYTHON_INCLUDE_DIR:PATH=${python_include} -DPYTHON_LIBRARY:PATH=${python_library} ) endif() +## ############################################################################# +## Check if patch has to be applied +## ############################################################################# + +ep_GeneratePatchCommand(${ep} ${ep}_PATCH_COMMAND VTK.patch) + ## ############################################################################# ## Add external-project ## ############################################################################# @@ -164,6 +170,7 @@ ExternalProject_Add(${ep} DEPENDS ${${ep}_dependencies} INSTALL_COMMAND "" ) + ## ############################################################################# ## Set variable to provide infos about the project ## ############################################################################# diff --git a/superbuild/projects_modules/medInria.cmake b/superbuild/projects_modules/medInria.cmake index 55f430d597..9c2c1d64ad 100644 --- a/superbuild/projects_modules/medInria.cmake +++ b/superbuild/projects_modules/medInria.cmake @@ -141,9 +141,10 @@ ExternalProject_Add(${ep} ## ############################################################################# if (WIN32) + file(REAL_PATH ${TTK_DIR}/../../../ _TTK_DIR) file(TO_NATIVE_PATH ${ITK_ROOT} ITK_BIN_BASE) file(TO_NATIVE_PATH ${VTK_ROOT} VTK_BIN_BASE) - file(TO_NATIVE_PATH ${TTK_ROOT} TTK_BIN_BASE) + file(TO_NATIVE_PATH ${_TTK_DIR} TTK_BIN_BASE) file(TO_NATIVE_PATH ${dtk_ROOT} DTK_BIN_BASE) file(TO_NATIVE_PATH ${QtDCM_ROOT} DCM_BIN_BASE) file(TO_NATIVE_PATH ${_qt5Core_install_prefix} QT5_BIN_BASE) diff --git a/superbuild/projects_modules/music-plugins.cmake b/superbuild/projects_modules/music-plugins.cmake index ba47525e8e..ec7285ee09 100644 --- a/superbuild/projects_modules/music-plugins.cmake +++ b/superbuild/projects_modules/music-plugins.cmake @@ -40,8 +40,8 @@ function(music_plugins_project) if (NOT USE_SYSTEM_${external_project}) - set(git_url ${GITHUB_PREFIX}mathildemerle/music.git) - set(git_tag vtk9Package) + set(git_url ${GITHUB_PREFIX}Inria-Asclepios/music.git) + set(git_tag master) set(cmake_args ${ep_common_cache_args} From 350b1fba2b4195a7c958fbbc3b067139ab2c278f Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Mon, 25 Nov 2024 09:17:13 +0100 Subject: [PATCH 07/20] [ReleaseNotes] update 4.0.6 for pipeline closing layers (#863) --- RELEASE_NOTES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 6285b2aebb..691f731b52 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,5 +1,6 @@ MUSICardio 4.0.6: - PolygonROI: remove shift-click to draw, fix contrast after deactivation of repulsor and hide deactivated widgets. +- Pipelines: put back the possibility of closing layers at result steps. MUSICardio 4.0.5: - Allow to use data with different size or spacing in LCCLogDemons and DiffeomorphicDemons. From 58fe580e2d4ffce8991fcf9bf93b83076d04e007 Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Mon, 25 Nov 2024 10:41:37 +0100 Subject: [PATCH 08/20] [VOICutter] fix output if no segmentation is done (#864) * [Release] 4.0.6 polygon roi fixes * [VOICutter] fix output if no segmentation is done --- RELEASE_NOTES.txt | 2 +- src/plugins/legacy/voiCutter/voiCutterToolBox.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 691f731b52..e13995b89a 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,6 +1,6 @@ MUSICardio 4.0.6: - PolygonROI: remove shift-click to draw, fix contrast after deactivation of repulsor and hide deactivated widgets. -- Pipelines: put back the possibility of closing layers at result steps. +- Pipelines: put back the possibility of closing layers at result steps, fix VOICutter if no segmentation is done. MUSICardio 4.0.5: - Allow to use data with different size or spacing in LCCLogDemons and DiffeomorphicDemons. diff --git a/src/plugins/legacy/voiCutter/voiCutterToolBox.cpp b/src/plugins/legacy/voiCutter/voiCutterToolBox.cpp index 36710a3643..b8bcfed9cd 100644 --- a/src/plugins/legacy/voiCutter/voiCutterToolBox.cpp +++ b/src/plugins/legacy/voiCutter/voiCutterToolBox.cpp @@ -280,6 +280,11 @@ dtkPlugin* voiCutterToolBox::plugin() return medPluginManager::instance().plugin("VOI Cutter"); } +/** + * @brief Return cropped data if VOI Cutter has been used or initial data, or nullptr if no data is found. + * + * @return medAbstractData* + */ medAbstractData *voiCutterToolBox::processOutput() { if (d->resultData) @@ -287,6 +292,10 @@ medAbstractData *voiCutterToolBox::processOutput() fillOutputMetaData(); return d->resultData; } + else if (d->currentView) + { + return d->currentView->layerData(d->currentView->currentLayer()); + } return nullptr; } From ee151bdf71bd83568ae527af81b8a4f6c213df9d Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Mon, 25 Nov 2024 10:49:42 +0100 Subject: [PATCH 09/20] [Release] 4.0.6 polygon roi fixes (#865) --- RELEASE_NOTES.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index e13995b89a..b1408d9a39 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,6 +1,9 @@ MUSICardio 4.0.6: - PolygonROI: remove shift-click to draw, fix contrast after deactivation of repulsor and hide deactivated widgets. -- Pipelines: put back the possibility of closing layers at result steps, fix VOICutter if no segmentation is done. +- Pipelines: + * put back the possibility of closing layers at result steps, + * fix VOICutter if no segmentation is done, + * fix Histogram Analysis non manual algorithms. MUSICardio 4.0.5: - Allow to use data with different size or spacing in LCCLogDemons and DiffeomorphicDemons. From 3cc315fea6e38936249e946bb42ba575f55052d8 Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Mon, 25 Nov 2024 11:00:14 +0100 Subject: [PATCH 10/20] [Release] 4.0.6 polygon roi fixes (#868) --- RELEASE_NOTES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index b1408d9a39..9e314a1382 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,4 +1,5 @@ MUSICardio 4.0.6: +- Debug import of Carto .zip archives and .mesh files. - PolygonROI: remove shift-click to draw, fix contrast after deactivation of repulsor and hide deactivated widgets. - Pipelines: * put back the possibility of closing layers at result steps, From a9b281d67d6ce6a6a8f257cd48db50f774c89da4 Mon Sep 17 00:00:00 2001 From: fcollot Date: Mon, 9 Dec 2024 14:51:01 +0100 Subject: [PATCH 11/20] Retrieve FilePath metadata, facilitate direct call to data import (#870) --- .../medCoreLegacy/database/medAbstractDatabaseImporter.cpp | 1 + .../medCoreLegacy/database/medAbstractDatabaseImporter.h | 3 ++- .../medCoreLegacy/database/medDatabasePersistentController.cpp | 2 ++ src/layers/legacy/medCoreLegacy/database/medDatabaseReader.cpp | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/layers/legacy/medCoreLegacy/database/medAbstractDatabaseImporter.cpp b/src/layers/legacy/medCoreLegacy/database/medAbstractDatabaseImporter.cpp index 6712c9e2cf..61828b0a10 100644 --- a/src/layers/legacy/medCoreLegacy/database/medAbstractDatabaseImporter.cpp +++ b/src/layers/legacy/medCoreLegacy/database/medAbstractDatabaseImporter.cpp @@ -514,6 +514,7 @@ void medAbstractDatabaseImporter::importData() // Now, populate the database medDataIndex index = this->populateDatabaseAndGenerateThumbnails ( d->data, thumb_dir ); + d->index = index; if (d->data->hasMetaData(medMetaDataKeys::Toolbox.key()) && d->data->metadata(medMetaDataKeys::Toolbox.key())=="PolygonROI" && diff --git a/src/layers/legacy/medCoreLegacy/database/medAbstractDatabaseImporter.h b/src/layers/legacy/medCoreLegacy/database/medAbstractDatabaseImporter.h index 2e62e7cd4a..e8ee9f87f8 100644 --- a/src/layers/legacy/medCoreLegacy/database/medAbstractDatabaseImporter.h +++ b/src/layers/legacy/medCoreLegacy/database/medAbstractDatabaseImporter.h @@ -48,6 +48,8 @@ class MEDCORELEGACY_EXPORT medAbstractDatabaseImporter : public medJobItemL const QUuid &uuid); ~medAbstractDatabaseImporter() override; + medDataIndex index(void) const; + signals: /** * This signal is emitted after a successful import/index. @@ -74,7 +76,6 @@ public slots: bool indexWithoutImporting ( void ); QMap volumeIdToImageFile ( void ); QString callerUuid ( void ); - medDataIndex index(void) const; void populateMissingMetadata ( medAbstractData* medData, const QString seriesDescription ); void addAdditionalMetaData ( medAbstractData* imData, QString aggregatedFileName, QStringList aggregatedFilesPaths ); diff --git a/src/layers/legacy/medCoreLegacy/database/medDatabasePersistentController.cpp b/src/layers/legacy/medCoreLegacy/database/medDatabasePersistentController.cpp index 45772ed64f..30577712c2 100644 --- a/src/layers/legacy/medCoreLegacy/database/medDatabasePersistentController.cpp +++ b/src/layers/legacy/medCoreLegacy/database/medDatabasePersistentController.cpp @@ -80,6 +80,8 @@ void medDatabasePersistentControllerPrivate::buildMetaDataLookup() metaDataLookup.insert(medMetaDataKeys::StudyDate.key(), TableEntryList() << TableEntry(T_study, "date")); // Series Data + metaDataLookup.insert(medMetaDataKeys::FilePaths.key(), + TableEntryList() << TableEntry(T_series, "path")); metaDataLookup.insert(medMetaDataKeys::Size.key(), TableEntryList() << TableEntry(T_series, "size")); metaDataLookup.insert(medMetaDataKeys::SeriesDescription.key(), diff --git a/src/layers/legacy/medCoreLegacy/database/medDatabaseReader.cpp b/src/layers/legacy/medCoreLegacy/database/medDatabaseReader.cpp index 39f970efa8..3903c5cea4 100644 --- a/src/layers/legacy/medCoreLegacy/database/medDatabaseReader.cpp +++ b/src/layers/legacy/medCoreLegacy/database/medDatabaseReader.cpp @@ -203,6 +203,7 @@ medAbstractData* medDatabaseReader::run() QFileInfo fullThumbnailPathInfo(fullThumbnailPath); medMetaDataKeys::SeriesThumbnail.add (medData, fullThumbnailPath); + medMetaDataKeys::FilePaths.set ( medData, seriesPath ); medMetaDataKeys::PatientID.set ( medData, patientId ); medMetaDataKeys::PatientName.set ( medData, patientName ); medMetaDataKeys::BirthDate.set ( medData, birthdate ); From 9cc5aaae6f5de5eedc541e86da3103844be01971 Mon Sep 17 00:00:00 2001 From: fcollot Date: Tue, 10 Dec 2024 17:11:10 +0100 Subject: [PATCH 12/20] Update RELEASE_NOTES.txt (#871) --- RELEASE_NOTES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 9e314a1382..96a507fbda 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -5,6 +5,7 @@ MUSICardio 4.0.6: * put back the possibility of closing layers at result steps, * fix VOICutter if no segmentation is done, * fix Histogram Analysis non manual algorithms. + * fix pipeline crash when saving data. MUSICardio 4.0.5: - Allow to use data with different size or spacing in LCCLogDemons and DiffeomorphicDemons. From 54a2b7d712548bdd2ff33f04c0ec322a5edca5aa Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Tue, 14 Jan 2025 10:15:43 +0100 Subject: [PATCH 13/20] Create musicardio-macos.yml --- .github/workflows/musicardio-macos.yml | 161 +++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 .github/workflows/musicardio-macos.yml diff --git a/.github/workflows/musicardio-macos.yml b/.github/workflows/musicardio-macos.yml new file mode 100644 index 0000000000..fcec6dde18 --- /dev/null +++ b/.github/workflows/musicardio-macos.yml @@ -0,0 +1,161 @@ +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: MUSICardio on macOS + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + inputs: + EXPIRATION_TIME: + description: 'Expiration time in month' + required: true + default: '12' + type: string + #schedule: + # - cron: '0 0 * * 1' # Each monday at 0h00, MIN HOUR DAY_IN_MONTH MONTH WEEK_DAY + +env: + BUILD_TYPE: Release + QT5_DIR: "/usr/local/opt/qt@5/lib/cmake/Qt5" + OpenMP_ROOT: "/usr/local/Cellar/libomp/19.1.0" + MSC_SSH_PLUGINS: ${{ secrets.MSC_SSH_PLUGINS }} + MSC_TOKEN: ${{ secrets.MSC_TOKEN }} + +jobs: + build: + # https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job#standard-github-hosted-runners-for-public-repositories + runs-on: macos-12 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up SSH + run: | + mkdir -p ~/.ssh + echo "$MSC_SSH_PLUGINS" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan github.com >> ~/.ssh/known_hosts + + - name: Install dependencies + run: | + brew install qt@5 + brew install boost + brew info libomp + pip3 install dmgbuild + # brew info cmake + # brew info swig + + - name: Set default EXPIRATION_TIME if not provided (with non manual workflow) + run: echo "EXPIRATION_TIME=${{ inputs.EXPIRATION_TIME || '12' }}" >> $GITHUB_ENV + + - name: Configure CMake + run: | + cmake -B ${{github.workspace}}/build \ + -DUSE_GITHUB_SSH:BOOL=TRUE \ + -DmedInria_BUILD_TYPE:STRING=$BUILD_TYPE \ + -Dmusic-plugins_BUILD_TYPE:STRING=$BUILD_TYPE \ + -DEP_CHECKBOX_CUSTOM_DIRS:BOOL=ON \ + -DEP_CHECKBOX_ON_TOP_LEVEL:BOOL=OFF \ + -DEP_CHECKBOX_SIDE_BY_SIDE:BOOL=OFF \ + -DQt5_DIR=$QT5_DIR \ + -DOpenMP_ROOT=$OpenMP_ROOT \ + -DUSE_FFmpeg=ON \ + -DEXPIRATION_TIME:STRING=$EXPIRATION_TIME \ + -DUSE_RealTimeWorkspace=OFF + + - name: Build + run: | + CORES_TO_USE=$(($(sysctl -n hw.ncpu) - 1)) # Limit the number of used core otherwise the compilation crashes sometimes + echo "Using $CORES_TO_USE cores for the build" + cmake --build ${{github.workspace}}/build --config $BUILD_TYPE --parallel $CORES_TO_USE + + - name: Package + run: | + cd ${{github.workspace}}/build + cpack -C $BUILD_TYPE + + - name: Prepare DMG and update design + run: | + cd ${{github.workspace}}/build + dmg=$(ls *.dmg) + echo "The current package to adapt: $dmg" + + if [ -n "$dmg" ]; then + # Attach to read-write format and retrieve mount path + path=$(hdiutil attach -owners on $dmg -shadow | grep -i 'Volumes' | cut -f 3) + echo "The current path: $path" + + # Navigate to correct directory + cd "$path/MUSICardio.app/Contents/" + + pathPluginsLegacy="${{github.workspace}}/build/medInria-build/bin/plugins_legacy" + + # Change library paths for plugins + for f in PlugIns/*.dylib; do + install_name_tool -change $pathPluginsLegacy/libAAMeshInteractorPlugin.dylib @executable_path/../PlugIns/libAAMeshInteractorPlugin.dylib $f + install_name_tool -change $pathPluginsLegacy/libAAAMeshUtilityPlugin.dylib @executable_path/../PlugIns/libAAAMeshUtilityPlugin.dylib $f + install_name_tool -change $pathPluginsLegacy/libAAAmedPipelinePlugin.dylib @executable_path/../PlugIns/libAAAmedPipelinePlugin.dylib $f + install_name_tool -change $pathPluginsLegacy/libmscPipelinesPlugin.dylib @executable_path/../PlugIns/libmscPipelinesPlugin.dylib $f + install_name_tool -change $pathPluginsLegacy/libAAAEPMapPlugin.dylib @executable_path/../PlugIns/libAAAEPMapPlugin.dylib $f + install_name_tool -change $pathPluginsLegacy/libAAMFSSimulationPlugin.dylib @executable_path/../PlugIns/libAAMFSSimulationPlugin.dylib $f + install_name_tool -change $pathPluginsLegacy/libFEMForwardProblemPlugin.dylib @executable_path/../PlugIns/libFEMForwardProblemPlugin.dylib $f + done + + # Go back to original path + cd "${{github.workspace}}/build" + + # Update dmg design + echo "### Now we are going to update the dmg design" + volumeName=$(basename "$path") + dmgbuild -s ../packaging/apple/settings.json "$volumeName" MUSICardio.dmg + + echo "End of the processes" + else + echo "A problem happened in MSC compilation, no dmg is built" + fi + + - name: Transfer binary to external repository + run: | + if [ -z "$MSC_TOKEN" ]; then + echo "MSC_TOKEN is not set" + exit 1 + fi + + OWNER="Inria-Asclepios" + REPO="msc_binaries" + ASSET_NAME="MUSICardio.dmg" + NEW_BINARY_PATH="MUSICardio.dmg" + + # Get the release and asset (binary) ID + RELEASE_INFO=$(curl -s -H "Authorization: Bearer $MSC_TOKEN" \ + "https://api.github.com/repos/$OWNER/$REPO/releases/latest") + echo "RELEASE_INFO: $RELEASE_INFO" + RELEASE_ID=$(echo $RELEASE_INFO | jq -r '.id') + ASSET_ID=$(echo $RELEASE_INFO | jq -r --arg NAME "$ASSET_NAME" '.assets[] | select(.name == $NAME) | .id') + + if [ "$RELEASE_ID" == "null" ] || [ -z "$RELEASE_ID" ]; then + echo "No published release found. Please create a release first." + exit 1 + fi + + # Remove old asset if exist + if [ "$ASSET_ID" == "null" ] || [ -z "$ASSET_ID" ]; then + echo "No existing asset named $ASSET_NAME found in the release." + else + curl -X DELETE -H "Authorization: Bearer $MSC_TOKEN" \ + "https://api.github.com/repos/$OWNER/$REPO/releases/assets/$ASSET_ID" + echo "Asset $ASSET_NAME deleted successfully." + fi + + # Upload new binary + curl -X POST -H "Authorization: Bearer $MSC_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @"$NEW_BINARY_PATH" \ + "https://uploads.github.com/repos/$OWNER/$REPO/releases/$RELEASE_ID/assets?name=$ASSET_NAME" + + echo "New binary uploaded successfully." + From fd1a3acf2df5c687228016cbfd6d5c5aed2f6a06 Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Tue, 14 Jan 2025 10:17:35 +0100 Subject: [PATCH 14/20] Update musicardio-macos.yml -- macos13 --- .github/workflows/musicardio-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/musicardio-macos.yml b/.github/workflows/musicardio-macos.yml index fcec6dde18..e604b7b7da 100644 --- a/.github/workflows/musicardio-macos.yml +++ b/.github/workflows/musicardio-macos.yml @@ -27,7 +27,7 @@ env: jobs: build: # https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job#standard-github-hosted-runners-for-public-repositories - runs-on: macos-12 + runs-on: macos-13 steps: - name: Checkout repository From c367277b2fce97a55c37adc4eb275517055302d1 Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Tue, 14 Jan 2025 10:22:00 +0100 Subject: [PATCH 15/20] Update musicardio-macos.yml -- libomp --- .github/workflows/musicardio-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/musicardio-macos.yml b/.github/workflows/musicardio-macos.yml index e604b7b7da..d1a0dfd968 100644 --- a/.github/workflows/musicardio-macos.yml +++ b/.github/workflows/musicardio-macos.yml @@ -44,7 +44,7 @@ jobs: run: | brew install qt@5 brew install boost - brew info libomp + brew install libomp pip3 install dmgbuild # brew info cmake # brew info swig From 743addc9812f24153e585580da255e3242649943 Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Tue, 14 Jan 2025 10:25:21 +0100 Subject: [PATCH 16/20] Update musicardio-macos.yml -- libomp version --- .github/workflows/musicardio-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/musicardio-macos.yml b/.github/workflows/musicardio-macos.yml index d1a0dfd968..44237abd04 100644 --- a/.github/workflows/musicardio-macos.yml +++ b/.github/workflows/musicardio-macos.yml @@ -20,7 +20,7 @@ on: env: BUILD_TYPE: Release QT5_DIR: "/usr/local/opt/qt@5/lib/cmake/Qt5" - OpenMP_ROOT: "/usr/local/Cellar/libomp/19.1.0" + OpenMP_ROOT: "/usr/local/Cellar/libomp/19.1.6" MSC_SSH_PLUGINS: ${{ secrets.MSC_SSH_PLUGINS }} MSC_TOKEN: ${{ secrets.MSC_TOKEN }} From 8f9bae01502790e9985281fe7a9ed9f9ab37fa9c Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Thu, 16 Jan 2025 13:25:37 +0100 Subject: [PATCH 17/20] [4.0.7] polygonroi shift-click + remove contour (#872) * [4.0.7] polygonroi shift-click + remove contour * [4.0.7] release notes + voicutter pipeline metadata --- CMakeLists.txt | 2 +- RELEASE_NOTES.txt | 7 +++++++ packaging/apple/settings.json | 2 +- .../polygonRoi/toolboxes/polygonRoiToolBox.cpp | 2 +- .../polygonRoi/viewevent/baseViewEvent.cpp | 16 +++++++++++++++- .../polygonRoi/viewevent/defaultViewEvent.cpp | 4 +++- .../legacy/voiCutter/voiCutterToolBox.cpp | 1 - 7 files changed, 28 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db2ccb3cce..e861d4e0c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ endif() cmake_policy(SET CMP0074 NEW) if(NOT DEFINED ${MEDINRIA_SUPERBUILD_VERSION}) - set(MEDINRIA_SUPERBUILD_VERSION 4.0.6) + set(MEDINRIA_SUPERBUILD_VERSION 4.0.7) endif() SET(CMAKE_CXX_STANDARD 17) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 96a507fbda..1441272690 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,3 +1,10 @@ +MUSICardio 4.0.7: +- PolygonROI: + * fix drawing a contour with shift-click to be able to change zoom/contrast with click. + * fix removing a last contour/node which reset the label tool and allow to draw again. +- Registration step in pipelines allows to use Mouse Interaction Toolbox. +- VOICutterToolBox fix a crash with metadata in pipelines sometimes if a cut has been made. + MUSICardio 4.0.6: - Debug import of Carto .zip archives and .mesh files. - PolygonROI: remove shift-click to draw, fix contrast after deactivation of repulsor and hide deactivated widgets. diff --git a/packaging/apple/settings.json b/packaging/apple/settings.json index 9f5bea1fcd..4d5203c3a8 100644 --- a/packaging/apple/settings.json +++ b/packaging/apple/settings.json @@ -7,7 +7,7 @@ "window": { "position": { "x": 100, "y": 100 }, "size": { "width": 640, "height": 300 } }, "contents": [ - { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.6/MUSICardio.app" }, + { "x": 140, "y": 165, "type": "file", "path": "/Volumes/MUSICardio 4.0.7/MUSICardio.app" }, { "x": 480, "y": 165, "type": "link", "path": "/Applications" } ] } diff --git a/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp b/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp index 3ee5b22713..dccbed3fe4 100644 --- a/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp +++ b/src/plugins/legacy/polygonRoi/toolboxes/polygonRoiToolBox.cpp @@ -608,7 +608,7 @@ void polygonRoiToolBox::showHelp() const QString main = QString("

Main features

") + QString("
    ") - + QString("
  • Draw a contour: click on the data to create a contour
  • ") + + QString("
  • Draw a contour: shift+click on the data to create a contour
  • ") + QString("
  • Add a new label: click on '+' button in the label list
  • ") + QString("
  • Remove a label: click on '-' button in the label list
  • ") + QString("
  • Use a new label: select a label in the list, then click on the data
  • ") diff --git a/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp b/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp index aa2726b613..9df003938d 100644 --- a/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp +++ b/src/plugins/legacy/polygonRoi/viewevent/baseViewEvent.cpp @@ -224,7 +224,7 @@ bool baseViewEvent::mousePressEvent(medAbstractView * view, QMouseEvent *mouseEv globalVtkLeftButtonBehaviour = view2d->GetLeftButtonInteractionStyle(); view2d->SetLeftButtonInteractionStyle(vtkInteractorStyleImageView2D::InteractionTypeNull); } - else if (mouseEvent->modifiers() == Qt::NoModifier) + else if (mouseEvent->modifiers() == Qt::ShiftModifier) { for (polygonLabel *label : labelList) { @@ -237,6 +237,20 @@ bool baseViewEvent::mousePressEvent(medAbstractView * view, QMouseEvent *mouseEv } leftButtonBehaviour(view); } + else if (mouseEvent->modifiers()==Qt::NoModifier) + { + if (!isRepulsorActivated ) + { + vtkImageView2D *view2d = static_cast(currentView->backend())->view2D; + int currentLeftButtonBehaviour = view2d->GetLeftButtonInteractionStyle(); + if (currentLeftButtonBehaviour != globalVtkLeftButtonBehaviour && + currentLeftButtonBehaviour != vtkInteractorStyleImageView2D::InteractionTypeNull) + { + globalVtkLeftButtonBehaviour = currentLeftButtonBehaviour; + } + view2d->SetLeftButtonInteractionStyle(globalVtkLeftButtonBehaviour); + } + } } else if (mouseEvent->button()==Qt::RightButton) { diff --git a/src/plugins/legacy/polygonRoi/viewevent/defaultViewEvent.cpp b/src/plugins/legacy/polygonRoi/viewevent/defaultViewEvent.cpp index 9d72485260..c3601433cc 100644 --- a/src/plugins/legacy/polygonRoi/viewevent/defaultViewEvent.cpp +++ b/src/plugins/legacy/polygonRoi/viewevent/defaultViewEvent.cpp @@ -62,7 +62,9 @@ void defaultViewEvent::deleteLabel(polygonLabel *manager) int position = deleteLabelBase(manager); if (position==-1) { - dLabelToolBox->unselectAll(); + // The last contour/node of the data has been removed, we need to reset + dLabelToolBox->selectRow(0); + dLabelToolBox->forceItemSelection(); } else { diff --git a/src/plugins/legacy/voiCutter/voiCutterToolBox.cpp b/src/plugins/legacy/voiCutter/voiCutterToolBox.cpp index b8bcfed9cd..42712511df 100644 --- a/src/plugins/legacy/voiCutter/voiCutterToolBox.cpp +++ b/src/plugins/legacy/voiCutter/voiCutterToolBox.cpp @@ -289,7 +289,6 @@ medAbstractData *voiCutterToolBox::processOutput() { if (d->resultData) { - fillOutputMetaData(); return d->resultData; } else if (d->currentView) From 2c9c3a4259ea0b3d13651bcdca313d48f78e77fb Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Thu, 23 Jan 2025 09:07:10 +0100 Subject: [PATCH 18/20] [GithubAction] macos, branch 4.1, dependencies, sending method (#873) * [GithubAction] automatisation libomp env var + branch 4.1 * [GA] checkout ref 4.1 * [GA] prerequisites swig * [GithubAction] simplify and standardize sending of binaries * [GithubAction] asset name --- .github/workflows/musicardio-macos.yml | 69 ++++++++------------------ 1 file changed, 21 insertions(+), 48 deletions(-) diff --git a/.github/workflows/musicardio-macos.yml b/.github/workflows/musicardio-macos.yml index 44237abd04..66e838c31a 100644 --- a/.github/workflows/musicardio-macos.yml +++ b/.github/workflows/musicardio-macos.yml @@ -4,9 +4,9 @@ name: MUSICardio on macOS on: push: - branches: [ "master" ] + branches: [ "4.1" ] pull_request: - branches: [ "master" ] + branches: [ "4.1" ] workflow_dispatch: inputs: EXPIRATION_TIME: @@ -20,7 +20,6 @@ on: env: BUILD_TYPE: Release QT5_DIR: "/usr/local/opt/qt@5/lib/cmake/Qt5" - OpenMP_ROOT: "/usr/local/Cellar/libomp/19.1.6" MSC_SSH_PLUGINS: ${{ secrets.MSC_SSH_PLUGINS }} MSC_TOKEN: ${{ secrets.MSC_TOKEN }} @@ -32,6 +31,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: 4.1 - name: Set up SSH run: | @@ -44,11 +45,12 @@ jobs: run: | brew install qt@5 brew install boost - brew install libomp + brew install swig + brew install libomp + echo "OpenMP_ROOT=$(brew --prefix libomp)" >> $GITHUB_ENV pip3 install dmgbuild # brew info cmake - # brew info swig - + - name: Set default EXPIRATION_TIME if not provided (with non manual workflow) run: echo "EXPIRATION_TIME=${{ inputs.EXPIRATION_TIME || '12' }}" >> $GITHUB_ENV @@ -116,46 +118,17 @@ jobs: echo "End of the processes" else echo "A problem happened in MSC compilation, no dmg is built" - fi - - - name: Transfer binary to external repository - run: | - if [ -z "$MSC_TOKEN" ]; then - echo "MSC_TOKEN is not set" - exit 1 - fi - - OWNER="Inria-Asclepios" - REPO="msc_binaries" - ASSET_NAME="MUSICardio.dmg" - NEW_BINARY_PATH="MUSICardio.dmg" - - # Get the release and asset (binary) ID - RELEASE_INFO=$(curl -s -H "Authorization: Bearer $MSC_TOKEN" \ - "https://api.github.com/repos/$OWNER/$REPO/releases/latest") - echo "RELEASE_INFO: $RELEASE_INFO" - RELEASE_ID=$(echo $RELEASE_INFO | jq -r '.id') - ASSET_ID=$(echo $RELEASE_INFO | jq -r --arg NAME "$ASSET_NAME" '.assets[] | select(.name == $NAME) | .id') - - if [ "$RELEASE_ID" == "null" ] || [ -z "$RELEASE_ID" ]; then - echo "No published release found. Please create a release first." - exit 1 fi - - # Remove old asset if exist - if [ "$ASSET_ID" == "null" ] || [ -z "$ASSET_ID" ]; then - echo "No existing asset named $ASSET_NAME found in the release." - else - curl -X DELETE -H "Authorization: Bearer $MSC_TOKEN" \ - "https://api.github.com/repos/$OWNER/$REPO/releases/assets/$ASSET_ID" - echo "Asset $ASSET_NAME deleted successfully." - fi - - # Upload new binary - curl -X POST -H "Authorization: Bearer $MSC_TOKEN" \ - -H "Content-Type: application/octet-stream" \ - --data-binary @"$NEW_BINARY_PATH" \ - "https://uploads.github.com/repos/$OWNER/$REPO/releases/$RELEASE_ID/assets?name=$ASSET_NAME" - - echo "New binary uploaded successfully." - + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_name: Inria-Asclepios/msc_binaries + # A personal access token for the GitHub repository in which the release will be created and edited. + # It is recommended to create the access token with the following scopes: `repo, user, admin:repo_hook`. + repo_token: ${{ secrets.MSC_TOKEN }} + file: ${{github.workspace}}/build/MUSICardio.dmg + asset_name: MUSICardio.dmg + tag: latest + overwrite: true + body: "MUSICardio binaries" From ba5b269eac1551305a6616cb8301542e996b46d6 Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Tue, 28 Jan 2025 11:46:11 +0100 Subject: [PATCH 19/20] [4.0.7] changes of version number for description (#874) --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4d19e8c2c1..a7da209862 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.19) if(NOT DEFINED ${medInria_VERSION}) - set(medInria_VERSION 4.0.6) + set(medInria_VERSION 4.0.7) endif() project(medInria VERSION ${medInria_VERSION}) From cf6b1b600ffd78d2055f7cd69e8a7e83f4a53268 Mon Sep 17 00:00:00 2001 From: mathildemerle Date: Tue, 28 Jan 2025 11:46:47 +0100 Subject: [PATCH 20/20] [Paint] avoid non-needed code which can crash in processOutput method (#875) * [4.0.7] changes of version number for description * [Paint] rm unneeded methods from processOutput --- .../legacy/medAlgorithmPaint/medAlgorithmPaintToolBox.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/legacy/medAlgorithmPaint/medAlgorithmPaintToolBox.cpp b/src/plugins/legacy/medAlgorithmPaint/medAlgorithmPaintToolBox.cpp index 670c41ec18..f57c765cbc 100644 --- a/src/plugins/legacy/medAlgorithmPaint/medAlgorithmPaintToolBox.cpp +++ b/src/plugins/legacy/medAlgorithmPaint/medAlgorithmPaintToolBox.cpp @@ -519,8 +519,6 @@ medAbstractData* AlgorithmPaintToolBox::processOutput() // Check if painted data on the volume if (!m_undoStacks->empty() && !m_undoStacks->value(currentView)->isEmpty()) { - updateMaskWithMasterLabel(); - copyMetaData(m_maskData, m_imageData); return m_maskData; // return output data } else @@ -928,6 +926,7 @@ void AlgorithmPaintToolBox::setData( medAbstractData *medData ) else { m_maskData = medAbstractDataFactory::instance()->createSmartPointer( "itkDataImageUChar3" ); + medUtilities::setDerivedMetaData(m_maskData, m_imageData, ""); if ( !m_maskData ) {