void ChangeResolutionAction::DecreaseTimeWithMask(TimeFrequencyData& data) { size_t polCount = data.PolarizationCount(); for(size_t i=0;i<polCount;++i) { TimeFrequencyData polData(data.MakeFromPolarizationIndex(i)); const Mask2DCPtr mask = polData.GetSingleMask(); for(unsigned j=0;j<polData.ImageCount();++j) { const Image2DCPtr image = polData.GetImage(j); polData.SetImage(j, ThresholdTools::ShrinkHorizontally(_timeDecreaseFactor, image.get(), mask.get())); } data.SetPolarizationData(i, std::move(polData)); } size_t maskCount = data.MaskCount(); for(size_t i=0;i<maskCount;++i) { Mask2DCPtr mask = data.GetMask(i); Mask2DPtr newMask(new Mask2D(mask->ShrinkHorizontallyForAveraging(_timeDecreaseFactor))); data.SetMask(i, std::move(newMask)); } }
void ChangeResolutionAction::DecreaseTimeWithMask(TimeFrequencyData &data) { size_t polCount = data.PolarisationCount(); for(size_t i=0;i<polCount;++i) { TimeFrequencyData *polData = data.CreateTFDataFromPolarisationIndex(i); Mask2DCPtr mask = polData->GetSingleMask(); for(unsigned j=0;j<polData->ImageCount();++j) { Image2DCPtr image = polData->GetImage(j); polData->SetImage(j, ThresholdTools::ShrinkHorizontally(_timeDecreaseFactor, image, mask)); } delete polData; } size_t maskCount = data.MaskCount(); for(size_t i=0;i<maskCount;++i) { Mask2DCPtr mask = data.GetMask(i); Mask2DPtr newMask = mask->ShrinkHorizontallyForAveraging(_timeDecreaseFactor); data.SetMask(i, newMask); } }