From 398984588fd16cf3cd0ebc602e6f91df18453987 Mon Sep 17 00:00:00 2001 From: Nikos Efthimiou Date: Tue, 14 Feb 2023 09:46:01 -0500 Subject: [PATCH 1/6] Add ability to generate dynamic images Initial commit --- src/Shape_buildblock/GenerateImage.cxx | 114 +++++++++++++------ src/Shape_buildblock/Shape3D.cxx | 7 ++ src/buildblock/DynamicDiscretisedDensity.cxx | 6 + src/include/stir/DynamicDiscretisedDensity.h | 3 + src/include/stir/Shape/GenerateImage.h | 14 ++- src/include/stir/Shape/Shape3D.h | 2 + 6 files changed, 108 insertions(+), 38 deletions(-) diff --git a/src/Shape_buildblock/GenerateImage.cxx b/src/Shape_buildblock/GenerateImage.cxx index 6c807b16f..6832c78ea 100644 --- a/src/Shape_buildblock/GenerateImage.cxx +++ b/src/Shape_buildblock/GenerateImage.cxx @@ -3,6 +3,7 @@ /* Copyright (C) 2003-2011, Hammersmith Imanet Ltd Copyright (C) 2018-2022, University College London + Copyright (C) 2023, Athinoula A. Martinos Center for Biomedical Imaging This file is part of STIR. SPDX-License-Identifier: Apache-2.0 @@ -70,7 +71,7 @@ set_defaults() rel_start_time = 0; output_filename.resize(0); output_file_format_sptr = - OutputFileFormat >::default_sptr(); + OutputFileFormat::default_sptr(); } void GenerateImage::set_imaging_modality() @@ -122,6 +123,7 @@ initialise_keymap() add_key("image duration (sec)", &image_duration); add_key("image relative start time (sec)", &rel_start_time); + add_key("time frame definition filename", &frame_definition_filename); add_parsing_key("shape type", ¤t_shape_ptr); add_key("value", ¤t_value); @@ -144,6 +146,28 @@ post_processing() exam_info_sptr->patient_position.set_rotation(static_cast(patient_rotation_index)); exam_info_sptr->patient_position.set_orientation(static_cast(patient_orientation_index)); + if (frame_definition_filename.size()!=0) + { + TimeFrameDefinitions frame_defs(frame_definition_filename); + exam_info_sptr->set_time_frame_definitions(frame_defs); + } + else + { + if (image_duration>0.0) + { + std::vector start_times(1, rel_start_time); + std::vector durations(1, image_duration); + TimeFrameDefinitions frame_defs(start_times, durations); + exam_info_sptr->set_time_frame_definitions(frame_defs); + } + else + { + warning("image duration not set, so time frame definitions will not be initialised"); + } + // std::vector > frame_times(1, std::pair(0, 1)); + // frame_defs = TimeFrameDefinitions(frame_times); + } + if (!is_null_ptr( current_shape_ptr)) { shape_ptrs.push_back(current_shape_ptr); @@ -204,6 +228,29 @@ post_processing() warning("number of samples to take in x-direction should be strictly positive\n"); return true; } + + tmpl_image.reset( new VoxelsOnCartesianGrid(exam_info_sptr, + IndexRange3D(0,output_image_size_z-1, + -(output_image_size_y/2), + -(output_image_size_y/2)+output_image_size_y-1, + -(output_image_size_x/2), + -(output_image_size_x/2)+output_image_size_x-1), + CartesianCoordinate3D(0,0,0), + CartesianCoordinate3D(output_voxel_size_z, + output_voxel_size_y, + output_voxel_size_x))); + + shared_ptr scn(Scanner::get_scanner_from_name((exam_info_sptr->originating_system))); + out_density_ptr.reset(new DynamicDiscretisedDensity(exam_info_sptr->get_time_frame_definitions(), + rel_start_time, + scn, + tmpl_image) ); + + for (unsigned int frame_num=1; frame_num < exam_info_sptr->get_time_frame_definitions().get_num_frames(); ++frame_num) + { + out_density_ptr->get_density_sptr(frame_num)->fill(0.f); + } + return false; } @@ -252,42 +299,33 @@ compute() #else - if (image_duration>0.0) - { - std::vector start_times(1, rel_start_time); - std::vector durations(1, image_duration); - TimeFrameDefinitions frame_defs(start_times, durations); - exam_info_sptr->set_time_frame_definitions(frame_defs); - } - else - { - warning("image duration not set, so time frame definitions will not be initialised"); - } - VoxelsOnCartesianGrid - current_image(exam_info_sptr, - IndexRange3D(0,output_image_size_z-1, - -(output_image_size_y/2), - -(output_image_size_y/2)+output_image_size_y-1, - -(output_image_size_x/2), - -(output_image_size_x/2)+output_image_size_x-1), - CartesianCoordinate3D(0,0,0), - CartesianCoordinate3D(output_voxel_size_z, - output_voxel_size_y, - output_voxel_size_x)); - this->out_density_ptr.reset(current_image.clone()); + for(int iframe = 1; iframe < exam_info_sptr->get_time_frame_definitions().get_num_time_frames(); ++iframe) + { + VoxelsOnCartesianGrid current_image = dynamic_cast&>(out_density_ptr->get_density(iframe)); +// this->out_density_ptr.reset(current_image.clone()); + info(boost::format("Processing time frame %d ...")%iframe, 2); #endif std::vector::const_iterator value_iter = values.begin(); for (std::vector >::const_iterator iter = shape_ptrs.begin(); - iter != shape_ptrs.end(); - ++iter, ++value_iter) - { + iter != shape_ptrs.end(); + ++iter, ++value_iter) + { + info("Processing next shape...", 2); - current_image.fill(0); - (**iter).construct_volume(current_image, num_samples); - current_image *= *value_iter; - *out_density_ptr += current_image; - } - return Succeeded::yes; +// current_image.fill(0); + if( (**iter).is_in_frame(iframe)) + { + VoxelsOnCartesianGrid tmp_image = *tmpl_image->clone(); + tmp_image.fill(10.f); + + (**iter).construct_volume(tmp_image, num_samples); + tmp_image *= *value_iter; + current_image += tmp_image; + } + out_density_ptr->set_density(current_image, iframe); + } +} +return Succeeded::yes; } Succeeded @@ -300,9 +338,15 @@ save_image() shared_ptr> GenerateImage:: -get_output_sptr() +get_output_sptr(unsigned int frame) { - return out_density_ptr; + return out_density_ptr->get_density_sptr(frame); } +shared_ptr + GenerateImage:: + get_all_outputs_sptr() +{ + return out_density_ptr; +} END_NAMESPACE_STIR diff --git a/src/Shape_buildblock/Shape3D.cxx b/src/Shape_buildblock/Shape3D.cxx index 7fc34a2a1..9a43d2ab1 100644 --- a/src/Shape_buildblock/Shape3D.cxx +++ b/src/Shape_buildblock/Shape3D.cxx @@ -229,6 +229,13 @@ Shape3D:: initialise_keymap() { this->parser.add_key("origin (in mm)", &origin); + this->parser.add_key("frames", &frames); +} + +bool +Shape3D::is_in_frame(const unsigned int this_frame) const +{ + return std::find(frames.begin(), frames.end(), this_frame)!=frames.end() ? true : false; } std::string diff --git a/src/buildblock/DynamicDiscretisedDensity.cxx b/src/buildblock/DynamicDiscretisedDensity.cxx index d2c39f26f..ea096d62d 100644 --- a/src/buildblock/DynamicDiscretisedDensity.cxx +++ b/src/buildblock/DynamicDiscretisedDensity.cxx @@ -103,6 +103,12 @@ DynamicDiscretisedDensity:: get_density(const unsigned int frame_num) { return *this->_densities.at(frame_num-1) ; } +shared_ptr > + DynamicDiscretisedDensity::get_density_sptr(const unsigned int frame_num) const +{ + return this->_densities[frame_num]; +} + const float DynamicDiscretisedDensity:: get_isotope_halflife() const diff --git a/src/include/stir/DynamicDiscretisedDensity.h b/src/include/stir/DynamicDiscretisedDensity.h index fcb916c45..4a4368ca8 100644 --- a/src/include/stir/DynamicDiscretisedDensity.h +++ b/src/include/stir/DynamicDiscretisedDensity.h @@ -143,6 +143,9 @@ class DynamicDiscretisedDensity: public ExamData const singleDiscDensT & get_density(const unsigned int frame_num) const ; + shared_ptr > + get_density_sptr(const unsigned int frame_num) const; + const singleDiscDensT & operator[](const unsigned int frame_num) const { return this->get_density(frame_num); } diff --git a/src/include/stir/Shape/GenerateImage.h b/src/include/stir/Shape/GenerateImage.h index 52565ea96..1ca74325e 100644 --- a/src/include/stir/Shape/GenerateImage.h +++ b/src/include/stir/Shape/GenerateImage.h @@ -3,6 +3,7 @@ /* Copyright (C) 2003-2011, Hammersmith Imanet Ltd Copyright (C) 2018-2022, University College London + Copyright (C) 2023, Athinoula A. Martinos Center for Biomedical Imaging This file is part of STIR. SPDX-License-Identifier: Apache-2.0 @@ -111,6 +112,7 @@ #include "stir/Succeeded.h" #include "stir/IO/OutputFileFormat.h" #include "stir/VoxelsOnCartesianGrid.h" +#include "stir/DynamicDiscretisedDensity.h" #include @@ -134,7 +136,9 @@ class GenerateImage : public KeyParser Succeeded save_image(); //! Returns the discretised density with computed shapes. - shared_ptr> get_output_sptr(); + shared_ptr> get_output_sptr(unsigned int frame = 0); + + shared_ptr get_all_outputs_sptr(); private: @@ -149,14 +153,16 @@ class GenerateImage : public KeyParser int patient_orientation_index; int patient_rotation_index; - shared_ptr > out_density_ptr; + shared_ptr out_density_ptr; + shared_ptr > + tmpl_image; std::vector > shape_ptrs; shared_ptr current_shape_ptr; std::vector values; float current_value; std::string output_filename; - shared_ptr > > output_file_format_sptr; + shared_ptr >output_file_format_sptr; void increment_current_shape_num(); @@ -171,6 +177,8 @@ class GenerateImage : public KeyParser double image_duration; double rel_start_time; + std::string frame_definition_filename; + }; END_NAMESPACE_STIR diff --git a/src/include/stir/Shape/Shape3D.h b/src/include/stir/Shape/Shape3D.h index 48b754202..21bf8793f 100644 --- a/src/include/stir/Shape/Shape3D.h +++ b/src/include/stir/Shape/Shape3D.h @@ -118,6 +118,7 @@ class Shape3D : */ virtual bool is_inside_shape(const CartesianCoordinate3D& coord) const = 0; + bool is_in_frame(const unsigned int this_frame) const; //! translate the whole shape by shifting its origin /*! Uses set_origin(). @@ -202,6 +203,7 @@ class Shape3D : //! origin of the shape CartesianCoordinate3D origin; + std::vector frames; }; END_NAMESPACE_STIR From 084b0f07eda4a823d2db2532dd048583f4659984 Mon Sep 17 00:00:00 2001 From: Nikos Efthimiou Date: Tue, 14 Feb 2023 09:55:58 -0500 Subject: [PATCH 2/6] Documentation --- src/Shape_buildblock/Shape3D.cxx | 1 + src/buildblock/DynamicDiscretisedDensity.cxx | 4 +++- src/include/stir/DynamicDiscretisedDensity.h | 4 +++- src/include/stir/Shape/GenerateImage.h | 5 +++++ src/include/stir/Shape/Shape3D.h | 11 +++++++++-- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Shape_buildblock/Shape3D.cxx b/src/Shape_buildblock/Shape3D.cxx index 9a43d2ab1..d00968c16 100644 --- a/src/Shape_buildblock/Shape3D.cxx +++ b/src/Shape_buildblock/Shape3D.cxx @@ -16,6 +16,7 @@ \author Kris Thielemans \author Sanida Mustafovic + \author Nikos Efthimiou */ #include "stir/Shape/Shape3D.h" #include "stir/Shape/DiscretisedShape3D.h" diff --git a/src/buildblock/DynamicDiscretisedDensity.cxx b/src/buildblock/DynamicDiscretisedDensity.cxx index ea096d62d..1cd4006f0 100644 --- a/src/buildblock/DynamicDiscretisedDensity.cxx +++ b/src/buildblock/DynamicDiscretisedDensity.cxx @@ -7,11 +7,13 @@ \author Kris Thielemans \author Charalampos Tsoumpas \author Richard Brown - + \author Nikos Efthimiou + */ /* Copyright (C) 2005- 2011, Hammersmith Imanet Ltd Copyright (C) 2018, University College London + Copyright (C) 2023, Athinoula A. Martinos Center for Biomedical Imaging This file is part of STIR. SPDX-License-Identifier: Apache-2.0 diff --git a/src/include/stir/DynamicDiscretisedDensity.h b/src/include/stir/DynamicDiscretisedDensity.h index 4a4368ca8..8912e80a8 100644 --- a/src/include/stir/DynamicDiscretisedDensity.h +++ b/src/include/stir/DynamicDiscretisedDensity.h @@ -7,12 +7,14 @@ \author Kris Thielemans \author Charalampos Tsoumpas \author Richard Brown - + \author Nikos Efthimiou + */ /* Copyright (C) 2005 - 2011-01-12, Hammersmith Imanet Ltd Copyright (C) 2011-07-01 - 2011, Kris Thielemans Copyright (C) 2018-2020 University College London + Copyright (C) 2023, Athinoula A. Martinos Center for Biomedical Imaging This file is part of STIR. SPDX-License-Identifier: Apache-2.0 diff --git a/src/include/stir/Shape/GenerateImage.h b/src/include/stir/Shape/GenerateImage.h index 1ca74325e..158dad740 100644 --- a/src/include/stir/Shape/GenerateImage.h +++ b/src/include/stir/Shape/GenerateImage.h @@ -19,6 +19,7 @@ \author Kris Thielemans \author Sanida Mustafovic \author Robert Twyman + \author Nikos Efthimiou \par Example .par file \code @@ -55,6 +56,9 @@ scale_to_write_data:= 1 End Interfile Output File Format Parameters:= + ; Used with simulation of dynamic images + ; time frame definition filename := frames.fdef + X output image size (in pixels):= 13 Y output image size (in pixels):= 13 Z output image size (in pixels):= 15 @@ -78,6 +82,7 @@ radius-y (in mm):= 2 length-z (in mm):= 3 origin (in mm):= {z,y,x} + ; frames := {1, 2 , 7} END:= value := 10 diff --git a/src/include/stir/Shape/Shape3D.h b/src/include/stir/Shape/Shape3D.h index 21bf8793f..49342252a 100644 --- a/src/include/stir/Shape/Shape3D.h +++ b/src/include/stir/Shape/Shape3D.h @@ -2,6 +2,7 @@ // /* Copyright (C) 2000- 2007, Hammersmith Imanet Ltd + Copyright (C) 2023, Athinoula A. Martinos Center for Biomedical Imaging This file is part of STIR. SPDX-License-Identifier: Apache-2.0 @@ -16,6 +17,7 @@ \author Kris Thielemans \author Sanida Mustafovic + \author Nikos Efthimiou */ #ifndef __stir_Shape_Shape3D_h__ @@ -42,6 +44,9 @@ template class VoxelsOnCartesianGrid; However, this then needs some special treatment for some member functions, and you have to be somewhat careful with that class. + When dynamic images are generated the frames parameter can be used to + tell in which time frames this shape will be drawn. + \todo This could/should be generalised to allow general fuzzy shapes. Probably the only thing to change is to let is_inside_shape() return a float (between 0 and 1). This would solve some issues with @@ -60,6 +65,7 @@ template class VoxelsOnCartesianGrid; \verbatim ; specify origin as {z,y,x} origin (in mm):= ;defaults to {0,0,0} + frames := {0,0,} \endverbatim */ class Shape3D : @@ -117,7 +123,8 @@ class Shape3D : \todo replace by floating point return value? */ virtual bool is_inside_shape(const CartesianCoordinate3D& coord) const = 0; - + + //! Draw if in the correct time dynamic time frame bool is_in_frame(const unsigned int this_frame) const; //! translate the whole shape by shifting its origin /*! Uses set_origin(). @@ -202,7 +209,7 @@ class Shape3D : private: //! origin of the shape CartesianCoordinate3D origin; - + //! time frames that we will add this shape std::vector frames; }; From c65ae1cfe6baa5ade156d6cf116e5fae96e44f1a Mon Sep 17 00:00:00 2001 From: Nikos Efthimiou Date: Tue, 14 Feb 2023 10:12:55 -0500 Subject: [PATCH 3/6] Added some default behaviour --- src/Shape_buildblock/GenerateImage.cxx | 4 ++++ src/Shape_buildblock/Shape3D.cxx | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/Shape_buildblock/GenerateImage.cxx b/src/Shape_buildblock/GenerateImage.cxx index 6832c78ea..dfb9a2b30 100644 --- a/src/Shape_buildblock/GenerateImage.cxx +++ b/src/Shape_buildblock/GenerateImage.cxx @@ -163,6 +163,10 @@ post_processing() else { warning("image duration not set, so time frame definitions will not be initialised"); + std::vector start_times(1, 0); + std::vector durations(1, 1); + TimeFrameDefinitions frame_defs(start_times, durations); + exam_info_sptr->set_time_frame_definitions(frame_defs); } // std::vector > frame_times(1, std::pair(0, 1)); // frame_defs = TimeFrameDefinitions(frame_times); diff --git a/src/Shape_buildblock/Shape3D.cxx b/src/Shape_buildblock/Shape3D.cxx index d00968c16..4b38a3c88 100644 --- a/src/Shape_buildblock/Shape3D.cxx +++ b/src/Shape_buildblock/Shape3D.cxx @@ -236,6 +236,8 @@ initialise_keymap() bool Shape3D::is_in_frame(const unsigned int this_frame) const { + if(frames.size() == 0) + return true; return std::find(frames.begin(), frames.end(), this_frame)!=frames.end() ? true : false; } From 84debfb6f26a58f0cb293b78bd948d18820287da Mon Sep 17 00:00:00 2001 From: Nikos Efthimiou Date: Tue, 14 Feb 2023 10:53:43 -0500 Subject: [PATCH 4/6] small fixes for backwards compatibility Use shared_ptr to take single frames from the DynamicDiscretisedDensity. --- src/Shape_buildblock/GenerateImage.cxx | 14 ++++++-------- src/buildblock/DynamicDiscretisedDensity.cxx | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Shape_buildblock/GenerateImage.cxx b/src/Shape_buildblock/GenerateImage.cxx index dfb9a2b30..777db4449 100644 --- a/src/Shape_buildblock/GenerateImage.cxx +++ b/src/Shape_buildblock/GenerateImage.cxx @@ -163,7 +163,7 @@ post_processing() else { warning("image duration not set, so time frame definitions will not be initialised"); - std::vector start_times(1, 0); + std::vector start_times(1, rel_start_time); std::vector durations(1, 1); TimeFrameDefinitions frame_defs(start_times, durations); exam_info_sptr->set_time_frame_definitions(frame_defs); @@ -250,7 +250,7 @@ post_processing() scn, tmpl_image) ); - for (unsigned int frame_num=1; frame_num < exam_info_sptr->get_time_frame_definitions().get_num_frames(); ++frame_num) + for (unsigned int frame_num=1; frame_num <= exam_info_sptr->get_time_frame_definitions().get_num_frames(); ++frame_num) { out_density_ptr->get_density_sptr(frame_num)->fill(0.f); } @@ -303,9 +303,9 @@ compute() #else - for(int iframe = 1; iframe < exam_info_sptr->get_time_frame_definitions().get_num_time_frames(); ++iframe) + for(int iframe = 1; iframe <= exam_info_sptr->get_time_frame_definitions().get_num_time_frames(); ++iframe) { - VoxelsOnCartesianGrid current_image = dynamic_cast&>(out_density_ptr->get_density(iframe)); + shared_ptr > current_image = std::dynamic_pointer_cast >(out_density_ptr->get_density_sptr(iframe)); // this->out_density_ptr.reset(current_image.clone()); info(boost::format("Processing time frame %d ...")%iframe, 2); #endif @@ -316,17 +316,15 @@ compute() { info("Processing next shape...", 2); -// current_image.fill(0); if( (**iter).is_in_frame(iframe)) { VoxelsOnCartesianGrid tmp_image = *tmpl_image->clone(); - tmp_image.fill(10.f); (**iter).construct_volume(tmp_image, num_samples); tmp_image *= *value_iter; - current_image += tmp_image; + *current_image += tmp_image; } - out_density_ptr->set_density(current_image, iframe); +// out_density_ptr->set_density(current_image, iframe+1); } } return Succeeded::yes; diff --git a/src/buildblock/DynamicDiscretisedDensity.cxx b/src/buildblock/DynamicDiscretisedDensity.cxx index 1cd4006f0..bb1b2da00 100644 --- a/src/buildblock/DynamicDiscretisedDensity.cxx +++ b/src/buildblock/DynamicDiscretisedDensity.cxx @@ -106,9 +106,9 @@ get_density(const unsigned int frame_num) { return *this->_densities.at(frame_num-1) ; } shared_ptr > - DynamicDiscretisedDensity::get_density_sptr(const unsigned int frame_num) const +DynamicDiscretisedDensity::get_density_sptr(const unsigned int frame_num) const { - return this->_densities[frame_num]; + return this->_densities.at(frame_num-1); } const float From 8e057c7dfde099b155fd273fc976214e8a7facf0 Mon Sep 17 00:00:00 2001 From: Nikos Efthimiou Date: Tue, 14 Feb 2023 11:38:03 -0500 Subject: [PATCH 5/6] Bugfix; wrong default frame value for get_output_sptr --- .../SourceFiles/.generate_image1.par.swp | Bin 0 -> 12288 bytes src/include/stir/Shape/GenerateImage.h | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 examples/ROOT_files/ROOT_STIR_consistency/SourceFiles/.generate_image1.par.swp diff --git a/examples/ROOT_files/ROOT_STIR_consistency/SourceFiles/.generate_image1.par.swp b/examples/ROOT_files/ROOT_STIR_consistency/SourceFiles/.generate_image1.par.swp new file mode 100644 index 0000000000000000000000000000000000000000..5442dfb6a3c46b8574c88ac98a6b8f357ee9a85f GIT binary patch literal 12288 zcmeI2KX21O6u@80#85ympfVkF0jcAi6r&^i==TogF1Xz&8O2 zJ_!;7Omt@LhhPHnoH`+(iWD}KchXO1zk9m7_p>}$zCCMu?IEif7GS#s@b>llp!45mq%$Rw7I#y zzSZ29qswBn86>fmIumiwGwVsN0&#DU(H5~#JQGbB@wTvyl&cAwpkXpFwFc(Eb?m{b zzHs9@yK?!-)S95e$p9H317v^KnBPF z86X2>fDDiUGC&5%02v?yWZ*wEz*_*1=Kww-#sB}|_y6%lfDgzUq>pSPcaUqy_X_~u zkR#+B(m`_M8FC-7ka=VlImUUvAVZ7}!kKbZE%mwp&8yI6JF}z5WY|EJ4M55@H=RaSr8m_%)Em|*%JjGiw*SGsW6P&Sd z@APnYJiHo)GS!J}u??5iZbu*RRIsd<3eRVw9KgwUSe!?DLa}6@>64S+EK69% z4+Tpx+)273#5!0NlXw3nxpDSnXq4+{*%!lda8cKAmSOjlG2D-1*siq%JAWK)uq4mY zJY$1n>1;H8DzPe!51>-aKOx7pY+U9HNo7iLW> get_output_sptr(unsigned int frame = 0); + shared_ptr> get_output_sptr(unsigned int frame = 1); shared_ptr get_all_outputs_sptr(); From 1364b4bc31f10cb0286a3c7cb1b23ec313edc01c Mon Sep 17 00:00:00 2001 From: Nikos Efthimiou Date: Tue, 14 Feb 2023 12:59:56 -0500 Subject: [PATCH 6/6] less message printing and correct frame In the frame comparison we need to subtract 1 to be consistent --- src/Shape_buildblock/GenerateImage.cxx | 3 +-- src/Shape_buildblock/Shape3D.cxx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Shape_buildblock/GenerateImage.cxx b/src/Shape_buildblock/GenerateImage.cxx index 777db4449..e43a4c6c3 100644 --- a/src/Shape_buildblock/GenerateImage.cxx +++ b/src/Shape_buildblock/GenerateImage.cxx @@ -314,10 +314,9 @@ compute() iter != shape_ptrs.end(); ++iter, ++value_iter) { - - info("Processing next shape...", 2); if( (**iter).is_in_frame(iframe)) { + info("Processing next shape...", 2); VoxelsOnCartesianGrid tmp_image = *tmpl_image->clone(); (**iter).construct_volume(tmp_image, num_samples); diff --git a/src/Shape_buildblock/Shape3D.cxx b/src/Shape_buildblock/Shape3D.cxx index 4b38a3c88..56dc63e18 100644 --- a/src/Shape_buildblock/Shape3D.cxx +++ b/src/Shape_buildblock/Shape3D.cxx @@ -238,7 +238,7 @@ Shape3D::is_in_frame(const unsigned int this_frame) const { if(frames.size() == 0) return true; - return std::find(frames.begin(), frames.end(), this_frame)!=frames.end() ? true : false; + return std::find(frames.begin(), frames.end(), this_frame-1)!=frames.end() ? true : false; } std::string