Both of the ports you mentioned are far the city's. (Rome was about 45 min to one hour by car to the port) So just remember, if your non-ship excursion is late returning to port the ship will leave with out you!! Then it is your expense to meet up with the ship at the next port of call. also if there is an issue with weather or something and a port is missed the ship will not refund you for a non-ship excursion.
Ship Mate smart Phone app has lots of non-ship excursions listed for each port.
You can take the train from the port into Rome and then get around on the sub way. Subway stops are close to most major things you want to see in Rome. The subway runs every 10 to 15 min. The trick is catching a train back to port before the ship leaves. They train does not run as often as the sub way. I have spent a few weeks in Rome over a couple of trips and used the sub way to get around the city. I did not take the train to the port because I had all my luggage so I took a Limo that was I think 100 euro one way.
I would suggest if your only in Rome for a port day, I would stick with a ship excursion to your guaranteed to get back to the ship on time or the ship will ware for you. Also on a ship excursion they can get special entrance to attractions without the long lines that the general public has to stand in so you may get to see more. One day is no where near enough time to explore Rome.
When in Italy if you can, stop for lunch and a glass of wine, look for the small not fancy places that locals go to eat. The food is fantastic, wine with lunch is cheaper then bottled water. Sorry if I went on a bit, Rome is just my favorite city to visit.
Enjoy your cruise and please leave a review and photo's when you return