Rotated an Image but can't get an object count

I rotated an image with euler3d transform and resampler and it works fine. But then I ask to get an object count and get 0 objects which is not true based on the saved image.

using ResampleFilterType_2 = itk::ResampleImageFilter<DoubleImageType, ImageType>;

	  auto resampler = ResampleFilterType_2::New();
	  resampler->SetInput(Image_for_Ribs_2);
	  resampler->SetTransform(eulerTransform_ribs);
	  resampler->SetInterpolator(interpolator);
	  resampler->SetUseReferenceImage(true);
	  resampler->SetReferenceImage(image_for_reference_ribs);
	  resampler->SetDefaultPixelValue(100);


        
       
       //    DoubleImageType::Pointer Transformed_Image_for_Ribs = resampler->GetOutput();       
       
       
           resampler->Update();
           
           
            std::cerr <<"saving:  " << Image_for_Ribs_2->GetSpacing()<<"  "<<Image_for_Ribs_2->GetOrigin()<<"  " <<Image_for_Ribs_2->GetDirection()<<"  " <<Image_for_Ribs_2->GetRequestedRegion().GetSize()<<std::endl;     
           



      
         ///////////////       ////
         
         //  EXTRACT AND OPEN
         
         //////////////	///
                
        
        
           using PasteFilterType_Ribs = itk::PasteImageFilter<ImageType>;
                      
                 
                
          auto writer_ribs_2 = WriterType_Ribs::New();
	    writer_ribs_2->SetFileName("Rotated.dcm");
	    writer_ribs_2->SetInput(resampler->GetOutput());
	    writer_ribs_2->SetImageIO(dicomIO);
	    writer_ribs_2->Update(); 
               
            
          auto reader_ribs_4 = ReaderType_Ribs::New();  
	    reader_ribs_4->SetImageIO(dicomIO);
	    reader_ribs_4->SetFileName("Rotated.dcm");
	    reader_ribs_4->Update();
            
               
            
            using ExtractFilterType_Ribs = itk::ExtractImageFilter<ImageType, ImageType>;
             
               
              // set up the extraction region [one slice]
              
              
               auto image_ribs_final = ImageType::New();
              
                 image_ribs_final->SetRegions(region_reference_ribs);
	      image_ribs_final->Allocate(); 
                 image_ribs_final->FillBuffer(0);  
              
             
            image_ribs_extraction->SetRegions(region_reference_ribs);
	 image_ribs_extraction->Allocate(); 
            image_ribs_extraction = reader_ribs_4->GetOutput();
            reader_ribs_4->Update();*/
              
              
              
              
    	    
	    
	
      /*    auto writer_ribs_4 = WriterType_Ribs::New();
            writer_ribs_4->SetFileName("read ribs.dcm");
            writer_ribs_4->SetInput(reader_ribs_4->GetOutput());
            writer_ribs_4->SetImageIO(dicomIO);
                 
            writer_ribs_4->Update();*/
	    

                int final_slice_ribs = size_for_dimensions[0];
              

             auto connected_ribs_2 = ConnectedComponentImageFilterType_Ribs::New();
           connected_ribs_2->SetInput(resampler->GetOutput());
             std::cout  <<"number of cc: "<< connected_ribs_2->GetObjectCount()<<std::endl;   
             connected_ribs_2->Update();
              
              
                 
                  // APPLY SHAPE OPPENING SLICE BY SLICE  
                  
                  // LOOP
         
         //       std::cout << "Number of objects: " << std::endl;
         
         
       //   std::cerr <<"saving:  " << image_ribs_extraction->GetSpacing()<<"  "<<image_ribs_extraction->GetOrigin()<<"  " <<image_ribs_extraction->GetDirection()<<"  " <<image_ribs_extraction->GetRequestedRegion().GetSize()<<std::endl;   
       
         
                for(int slice_to_process = 0; slice_to_process < final_slice_ribs ; slice_to_process++){

                
                ImageType::RegionType inputRegion_ribs = resampler->GetOutput()->GetBufferedRegion();
                reader_ribs_4->Update();
                ImageType::SizeType   size_ribs = inputRegion_ribs.GetSize();
                
                size_ribs[2] = 1; // we extract along z direction
                
                ImageType::IndexType start_ribs = inputRegion_ribs.GetIndex();
                
                int  sliceNumber_ribs = slice_to_process + start_ribs[2];
              
                start_ribs[2] = sliceNumber_ribs;
                
                ImageType::RegionType desiredRegion_ribs;
                desiredRegion_ribs.SetSize(size_ribs);
                desiredRegion_ribs.SetIndex(start_ribs);
                
                auto extractFilter_ribs = ExtractFilterType_Ribs::New();
                extractFilter_ribs -> SetDirectionCollapseToSubmatrix();
                extractFilter_ribs->SetExtractionRegion(desiredRegion_ribs);
              extractFilter_ribs->SetInput(resampler->GetOutput());
                extractFilter_ribs->Update();
                 
                                    
            auto connected_ribs = ConnectedComponentImageFilterType_Ribs::New();
            connected_ribs->SetInput(extractFilter_ribs->GetOutput());

here are my original and rotated images:
1.tif (549.4 KB)
2.tif (347.2 KB)

Your code seems to be missing connected_ribs->Update(). Without it, object count will always be zero.