The following commit has been merged in the master branch: commit bdaf179cdc30d265393201ba0758ab1f49b53f3a Author: Gert Wollny <gw.foss...@gmail.com> Date: Fri Apr 26 14:07:08 2013 +0200
add two patched to fix a regression and update file format diff --git a/debian/changelog b/debian/changelog index f2e3ca9..0c5df44 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mia (2.0.9-1) UNRELEASED; urgency=low +mia (2.0.9-2) UNRELEASED; urgency=low * Upstream version bump * Fix "FTBFS on i386: 3 tests failed out of 228" - Lower accuracy @@ -11,8 +11,10 @@ mia (2.0.9-1) UNRELEASED; urgency=low number of running threads to 1 on powerpc and with threading building blocks version lower than 4.1u2 (see: #705385) * Fix package dependencies by also scanning all plug-in modules. + * Fix regression in 3d image scaler + * Change VTK vector field output target - -- Gert Wollny <gw.foss...@gmail.com> Fri, 19 Apr 2013 12:02:43 +0200 + -- Gert Wollny <gw.foss...@gmail.com> Fri, 26 Apr 2013 14:02:50 +0200 mia (2.0.8-1) unstable; urgency=low diff --git a/debian/patches/02-fix-parameter-scale-regression.patch b/debian/patches/02-fix-parameter-scale-regression.patch new file mode 100644 index 0000000..50e27e1 --- /dev/null +++ b/debian/patches/02-fix-parameter-scale-regression.patch @@ -0,0 +1,25 @@ +Description: Fix regression of removed plugin parameter + Reintroduce the 's' parameter that was deleted during the refactoring of the + scale plug-in but is required in the image registration code +Author: Gert Wollny <gw.foss...@gmail.com> + +--- + +Origin: upstream +Forwarded: not-needed +Upstream-Bug: https://sourceforge.net/p/mia/tickets/91/ +Last-Update: 2013-04-26 + +diff --git a/mia/3d/filter/scale.cc b/mia/3d/filter/scale.cc +index a1180cb..6d0fe58 100644 +--- a/mia/3d/filter/scale.cc ++++ b/mia/3d/filter/scale.cc +@@ -137,6 +137,8 @@ C3DScaleFilterPlugin::C3DScaleFilterPlugin(): + C3DFilterPlugin("scale"), + m_s(0,0,0) + { ++ add_parameter("s", new C3DBoundsParameter(m_s, 0,"target size to set all components at once (component 0:use input image size)")); ++ + add_parameter("sx", new CUIntParameter(m_s.x, 0, + numeric_limits<unsigned int>::max(), false, + "target size in x direction (0:use input image size)")); diff --git a/debian/patches/03-change-vtkvf-target-to-structured-point-set.patch b/debian/patches/03-change-vtkvf-target-to-structured-point-set.patch new file mode 100644 index 0000000..0adf77d --- /dev/null +++ b/debian/patches/03-change-vtkvf-target-to-structured-point-set.patch @@ -0,0 +1,148 @@ +Description: Change the target data type in VTK vector field IO + The target type is changed form STRUCTURED_GRID to STRUCTURED_POINST + because that seems to make more sense according to the VTK documentation + +Author: Gert Wollny <gw.foss...@gmail.com> + +--- + +Origin: upstream +Forwarded: not-needed +Upstream-Bug: https://sourceforge.net/p/mia/tickets/89/ +Last-Update: 2013-04-26 + + +diff --git a/addons/vtk/vtkvf.cc b/addons/vtk/vtkvf.cc +index 4fd9218..cd5d402 100644 +--- a/addons/vtk/vtkvf.cc ++++ b/addons/vtk/vtkvf.cc +@@ -20,9 +20,9 @@ + + #include <vtk/vtkvf.hh> + +-#include <vtkStructuredGridReader.h> +-#include <vtkStructuredGridWriter.h> +-#include <vtkStructuredGrid.h> ++#include <vtkStructuredPointsReader.h> ++#include <vtkStructuredPointsWriter.h> ++#include <vtkStructuredPoints.h> + #include <vtkSmartPointer.h> + #include <vtkPoints.h> + +@@ -41,9 +41,25 @@ CVtk3DVFIOPlugin::CVtk3DVFIOPlugin(): + + } + ++ ++template <typename T> ++C3DIOVectorfield *read_field_data(const C3DBounds& size, void *scalars) ++{ ++ cvdebug() << "VTKVF read vector data of type " << __type_descr<T>::value << "\n"; ++ ++ const T *my_scalars = reinterpret_cast<const T *>(scalars); ++ if (!my_scalars) ++ throw create_exception<logic_error>("CVtk3DImageIOPlugin::load: input image scalar type bogus"); ++ ++ C3DIOVectorfield *result = new C3DIOVectorfield(size); ++ copy(my_scalars, my_scalars + 3 * result->size(), &(*result)[0].x); ++ ++ return result; ++} ++ + CVtk3DVFIOPlugin::PData CVtk3DVFIOPlugin::do_load(const string& filename) const + { +- auto reader = vtkSmartPointer<vtkStructuredGridReader>::New(); ++ auto reader = vtkSmartPointer<vtkStructuredPointsReader>::New(); + reader->SetFileName(filename.c_str()); + auto iovf = reader->GetOutput(); + iovf->Update(); +@@ -57,54 +73,51 @@ CVtk3DVFIOPlugin::PData CVtk3DVFIOPlugin::do_load(const string& filename) const + } + + auto dims = iovf->GetDimensions(); ++ if (dim != 3) ++ throw create_exception<invalid_argument>("3D Vtkvf load (", filename , ++ "): Expect 3 dimensions but got ", dim); + C3DBounds size(dims[0], dims[1], dims[2]); ++ ++ int components = iovf->GetNumberOfScalarComponents(); ++ if (components != 3) ++ throw create_exception<invalid_argument>("3D Vtkvf load (", filename , ++ "): only 3D vectors are allowed, " ++ "but got ", components, " component elements"); ++ + +- PData result(new C3DIOVectorfield(size)); +- +- auto points = iovf->GetPoints(); +- +- +- if (points->GetNumberOfPoints() != size.product()) +- throw create_exception<invalid_argument>("Got ", points->GetNumberOfPoints(), +- " vectors but require ", size.product()); +- vtkIdType i = 0; +- for (auto iv = result->begin(); iv != result->end(); ++iv, ++i) { +- double x[3]; +- points->GetPoint (i, x); +- iv->x = x[0]; +- iv->y = x[1]; +- iv->z = x[2]; ++ auto array = iovf->GetScalarPointer(); ++ ++ C3DIOVectorfield *result_field = nullptr; ++ switch (iovf->GetScalarType()) { ++ case VTK_FLOAT: result_field=read_field_data<float>(size, array); break; ++ case VTK_DOUBLE: result_field=read_field_data<double>(size, array); break; ++ default: ++ throw create_exception<invalid_argument>("3D Vtkvf load (", filename ,"): " ++ "data type ", iovf->GetScalarTypeAsString(), ++ "(", iovf->GetScalarType(), ") not supported"); + } +- return result; ++ return PData(result_field); + } + + bool CVtk3DVFIOPlugin::do_save(const string& fname, const C3DIOVectorfield& data) const + { +- int dims[3]; +- dims[0] = data.get_size().x; +- dims[1] = data.get_size().y; +- dims[2] = data.get_size().z; +- +- auto sgrid = vtkSmartPointer<vtkStructuredGrid>::New(); +- sgrid->SetDimensions(dims); +- +- auto points = vtkSmartPointer<vtkPoints>::New(); +- points->Allocate(data.get_size().product()); +- +- int offset = 0; +- float v[3]; +- for (auto iv = data.begin(); iv != data.end(); ++iv, ++offset) { +- v[0] = iv->x; +- v[1] = iv->y; +- v[2] = iv->z; +- points->InsertPoint(offset, v); +- } +- sgrid->SetPoints(points); ++ ++ auto outfield = vtkSmartPointer<vtkStructuredPoints>::New(); ++ outfield->SetOrigin(0,0,0); ++ outfield->SetSpacing(1.0, 1.0, 1.0); ++ outfield->SetDimensions(data.get_size().x, data.get_size().y, data.get_size().z); ++ ++ outfield->SetScalarType(VTK_FLOAT); ++ outfield->SetNumberOfScalarComponents(3); ++ outfield->AllocateScalars(); ++ ++ float *out_ptr = reinterpret_cast<float*>(outfield->GetScalarPointer()); ++ copy(&data[0].x, &data[0].x + data.size() * 3, out_ptr); + +- auto writer = vtkSmartPointer<vtkStructuredGridWriter>::New(); ++ auto writer = vtkSmartPointer<vtkStructuredPointsWriter>::New(); + writer->SetFileName(fname.c_str()); + writer->SetFileTypeToBinary(); +- writer->SetInput(sgrid); ++ writer->SetInput(outfield); + return writer->Write(); + } + diff --git a/debian/patches/series b/debian/patches/series index 8526e67..f5f56b1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,3 @@ 01_disable-treeview-for-jquery-compatibility.patch +02-fix-parameter-scale-regression.patch +03-change-vtkvf-target-to-structured-point-set.patch -- Packaging of mia in Debian _______________________________________________ debian-med-commit mailing list debian-med-commit@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit