Commit 11ba4594 authored by David Youssefi's avatar David Youssefi

Merge branch '819-display-pixel-type-of-image-in-readimageinfo-application' into 'develop'

Resolve "Display Pixel type of Image in ReadImageInfo application"

Closes #819

See merge request !179
parents 338e4778 e6e8d08b
......@@ -114,6 +114,10 @@ private:
SetParameterDescription("numberbands", "Number of bands");
SetParameterRole("numberbands", Role_Output);
AddParameter(ParameterType_String,"datatype","Data type");
SetParameterDescription("datatype", "Data type");
SetParameterRole("datatype", Role_Output);
AddParameter(ParameterType_String,"sensor","Sensor id");
SetParameterDescription("sensor", "Sensor identifier");
SetParameterRole("sensor", Role_Output);
......@@ -267,6 +271,15 @@ private:
//Get number of bands
SetParameterInt("numberbands",inImage->GetNumberOfComponentsPerPixel());
ossOutput << "\tNumber of bands : " << GetParameterInt("numberbands") << std::endl;
// Get data type
ImageIOBase::IOComponentType typeInfo(ImageIOBase::UNKNOWNCOMPONENTTYPE);
itk::ExposeMetaData< ImageIOBase::IOComponentType >( inImage->GetMetaDataDictionary(),
MetaDataKey::DataType , typeInfo);
const std::string dataTypeAsString = ImageIOBase::GetComponentTypeAsString(typeInfo);
SetParameterString("datatype", dataTypeAsString);
ossOutput << "\tData type : " << GetParameterString("datatype") << std::endl;
std::vector<bool> noDataValueAvailable;
bool ret = itk::ExposeMetaData<std::vector<bool> >(inImage->GetMetaDataDictionary(),MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
......@@ -299,7 +312,7 @@ private:
SetParameterInt("indexx",inImage->GetLargestPossibleRegion().GetIndex()[0]);
SetParameterInt("indexy",inImage->GetLargestPossibleRegion().GetIndex()[1]);
ossOutput << "\tStart index : [" << GetParameterInt("indexx") << "," << GetParameterInt("indexy") << "]" << std::endl;
ossOutput << "\tStart index : [" << GetParameterInt("indexx") << "," << GetParameterInt("indexy") << "]" << std::endl;
//Get image size
SetParameterInt("sizex",inImage->GetLargestPossibleRegion().GetSize()[0]);
......
......@@ -204,7 +204,7 @@ public:
/** Convenience method returns the IOComponentType as a string. This can be
* used for writing output files. */
std::string GetComponentTypeAsString(IOComponentType) const;
static std::string GetComponentTypeAsString(IOComponentType);
/** Convenience method returns the IOPixelType as a string. This can be
* used for writing output files. */
......
......@@ -739,7 +739,7 @@ std::string ImageIOBase::GetByteOrderAsString(ByteOrder t) const
}
}
std::string ImageIOBase::GetComponentTypeAsString(IOComponentType t) const
std::string ImageIOBase::GetComponentTypeAsString(IOComponentType t)
{
std::string s;
switch(t)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment