Skip to content

Studio/ShapeWorksMONAI/MonaiLabelUtils.h

Namespaces

Name
shapeworks
User usage reporting (telemetry)
monailabel

Classes

Name
class monailabel::UrlValidator
class monailabel::MonaiLabelUtils

Source code

```cpp

pragma once

include

include

include

include

include

include

include

include

namespace shapeworks { class Session; } namespace monailabel {

typedef float PixelType; typedef itk::Image< PixelType, 3 > ImageType;

class UrlValidator : public QValidator { public: UrlValidator(QObject* parent = nullptr) : QValidator(parent) {}

QValidator::State validate(QString& input, int& pos) const override { Q_UNUSED(pos); QUrl url(input); if (!url.isValid() || (url.scheme() != "http" && url.scheme() != "https")) { return QValidator::Invalid; } // Allow '0.0.0.0' if (url.host() == "0.0.0.0") { if (url.port() == -1) { return QValidator::Invalid; } return QValidator::Acceptable; } if (url.host().isEmpty()) { return QValidator::Invalid; } if (url.port() == -1) { return QValidator::Invalid; } return QValidator::Acceptable; } }; class MonaiLabelUtils { public: static bool createDir(const QString& dirPath); static bool copySegmentation(const QString& sourcePath, const QString& destinationPath); static bool deleteTempFile(const QString& filePath); static std::string getFeatureName( QSharedPointer session); static ImageType::Pointer loadNRRD(const std::string& filePath); static ImageType::Pointer extractOrganSegmentation(ImageType::Pointer inputImage, int label); static void saveNRRD(ImageType::Pointer image, const std::string& outputPath); static bool isOrganPresent(ImageType::Pointer image);

static void processSegmentation(const std::string& segmentationPath, const std::map& organLabels, const std::string& outputDir, const std::string& sampleId, std::vector& organSegmentationPaths); };

} // namespace monailabel ```


Updated on 2026-03-31 at 16:02:11 +0000