Skip to content

Commit

Permalink
Separates initialisation of corrected slices and errors
Browse files Browse the repository at this point in the history
saves memory when these data are not required
  • Loading branch information
Joshua van Amerom committed Oct 26, 2017
1 parent fac7569 commit 0461d02
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/segmentation/applications/reconstructionCardiac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,11 @@ int main(int argc, char **argv)

//Create slices and slice-dependent transformations
reconstruction.CreateSlicesAndTransformationsCardiac4D(stacks,stack_transformations,thickness);

if(debug){
reconstruction.InitCorrectedSlices();
reconstruction.InitError();
}

//if given, read transformations
if (folder!=NULL)
reconstruction.ReadTransformation(folder); // image-frame to volume registrations
Expand Down
5 changes: 5 additions & 0 deletions packages/segmentation/include/irtkReconstructionCardiac4D.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ class irtkReconstructionCardiac4D : public irtkReconstruction
vector<irtkRigidTransformation>& stack_transformations,
vector<double>& thickness,
const vector<irtkRealImage> &probability_maps=vector<irtkRealImage>() );
/// Init Corrected Slices
void InitCorrectedSlices();

/// Init Error
void InitError();

// TODO: Calculate Cardiac Phase from Trigger Times
// void CalculateSliceCardiacPhases( vector<double>& trigger_times );

Expand Down
24 changes: 22 additions & 2 deletions packages/segmentation/src/irtkReconstructionCardiac4D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,9 @@ void irtkReconstructionCardiac4D::CreateSlicesAndTransformationsCardiac4D( vecto
_slice_dt.push_back(attr._dt);
//remember the slice
_slices.push_back(slice);
_corrected_slices.push_back(slice);
_simulated_slices.push_back(slice);
_simulated_weights.push_back(slice);
_simulated_inside.push_back(slice);
_error.push_back(slice);
//remeber stack indices for this slice
_stack_index.push_back(i);
_loc_index.push_back(loc_index);
Expand Down Expand Up @@ -426,6 +424,28 @@ void irtkReconstructionCardiac4D::CreateSlicesAndTransformationsCardiac4D( vecto
}


// -----------------------------------------------------------------------------
// InitCorrectedSlices
// -----------------------------------------------------------------------------
void irtkReconstructionCardiac4D::InitCorrectedSlices()
{
_corrected_slices.clear();
for (unsigned int inputIndex = 0; inputIndex < _slices.size(); inputIndex++)
_corrected_slices.push_back(_slices[inputIndex]);
}


// -----------------------------------------------------------------------------
// InitError
// -----------------------------------------------------------------------------
void irtkReconstructionCardiac4D::InitError()
{
_error.clear();
for (unsigned int inputIndex = 0; inputIndex < _slices.size(); inputIndex++)
_error.push_back(_slices[inputIndex]);
}


// -----------------------------------------------------------------------------
// TODO: Calculate Cardiac Phase from Trigger Times
// -----------------------------------------------------------------------------
Expand Down

0 comments on commit 0461d02

Please sign in to comment.